wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

[compiletime] `LinkedList<unit>` contains different `handle` value #1012

Closed GetLocalPlayer closed 3 years ago

GetLocalPlayer commented 3 years ago
@Test
function _LLTest()
    let u = createUnit(localPlayer, 'hfoo', ZERO2, angle(0))
    let list = new LinkedList<unit>
    list.add(u)
    print(u.getHandleId())
    print(list.get(0).getHandleId())
    assertTrue(u == list.get(0))

Compiletime output:

Running <Hello:26 - _LLTest>..
1240419865
1242175980
    FAILED assertion:
    Test failed: Assertion failed
... when calling assertTrue(false) in Hello.wurst:32
... when calling _LLTest() in Hello.wurst:26

Tests succeeded: 0/1

I guess it's for handles in general, since for group type is the same.

Frotty commented 3 years ago

Yes. This could only be adressed via new type classes, because current generics work via typecasting which will result in a new handle at compiletime.

GetLocalPlayer commented 3 years ago

Understandable. I'm closing then I guess.