Closed TobiasWrigstad closed 8 years ago
I can look at this while fixing #234!
Thanks!
I am a bit confused. I thought the error message is expected, for we are substituting t
with [t]
in the new
statement, and the return type becomes [[t]]
accordingly.
Let's make a more concrete example:
class List<t>
def eachElementAsAnArray() : List<[t]>
let l = new List<[t]> in
... -- some expression that ends in l
Would you agree that this code should compile?
Could you provide complete snippet?
passive class Container<t>
content : t
def containerWithArray() : Container<[t]>
let c = new Container<[t]> in {
c.content = [this.content];
c
}
class Main
def main() : void
let c1 = new Container<int> in{
c1.content = 42;
let c2 = c1.containerWithArray() in
assertTrue(c2.content[0] == c1.content);
print "passed"
}
OK, clearly now. Thanks.
Fixed as of 3619b53ae4a730f8a42e702641c0a87f4431f49b.
It seems an additional level of array is added.
generates