Closed phorward closed 7 months ago
This works:
Hello : @<World> mode = "standard" { 'Hello' _ Expect<Self> print(mode) World print(*World) } Earth : @{ 'Earth' } HelloEarth : @{ Hello<Earth>("modified") } HelloEarth #--- #HelloHelloEarth #--- #<parselet Earth> #standard #modified
This fails:
HelloEarth : @{ Hello<Earth>("modified") } Hello : @<World> mode = "standard" { 'Hello' _ Expect<Self> print(mode) World print(*World) } Earth : @{ 'Earth' } HelloEarth #--- #HelloHelloEarth #--- #<parselet Earth> #standard #modified
Example call:
$ cargo run -- tests/generics.tok -- HelloHelloEarth Finished dev [unoptimized + debuginfo] target(s) in 0.05s Running `target/debug/tokay tests/generics.tok -- HelloHelloEarth` Line 2, column 5: Cannot create instance from 'Hello' Line 2, column 5: Cannot create instance from 'Hello' Line 2, column 5: Cannot create instance from 'Hello' Line 2, column 5: Cannot create instance from 'Hello'
This works:
This fails:
Example call: