-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Structs that work and type check properly in a single file fail to work properly when imported. Reproducing example below:
Tested on commit 78169ab on master
# a.star
StructA = record(val=str)
StructB = record(a=StructA)# b.star
load("a.star", "StructA")
load("a.star", "StructB")
myB = StructB(a=StructA(val="foo"))
print(myB)# bNoImports.star
StructA = record(val=str)
StructB = record(a=StructA)
myB = StructB(a=StructA(val="foo"))
print(myB)$ pwd
/Users/simonzeng/repos/starlark-rust/starlark_bin
$ cargo run -- bNoImports.star
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s
Running `/Users/simonzeng/repos/starlark-rust/target/debug/starlark bNoImports.star`
record[StructB](a=record[StructA](val="foo"))
1 files, 0 errors, 0 warnings, 0 advices, 0 disabled
$ cargo run -- b.star
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s
Running `/Users/simonzeng/repos/starlark-rust/target/debug/starlark b.star`
Traceback (most recent call last):
* b.star:3, in <module>
myB = StructB(a=StructA(val="foo"))
error: Value `record[StructA](val="foo")` of type `record` does not match the type annotation `StructA` for argument `a`
--> b.star:3:7
|
3 | myB = StructB(a=StructA(val="foo"))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
1 files, 1 errors, 0 warnings, 0 advices, 0 disabled
Error: Failed with 1 errors
Metadata
Metadata
Assignees
Labels
No labels