-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
bugBug: something already implemented does not work as it shouldBug: something already implemented does not work as it shouldtcheckerRelated to type checkerRelated to type checkertemplatesRelated to the templateRelated to the template
Description
Consider this test:
"https://github.com/open2b/scriggo/issues/941": {
sources: fstest.Files{
"index.html": `{% var filters = filters default nil %}`,
},
main: native.Package{
Name: "main",
Declarations: native.Declarations{
"filters": (*[]int)(nil),
},
},
},
instead of returning an error relative to the use of the untyped nil, it panics the type checker.
Note that this code:
"https://github.com/open2b/scriggo/issues/941": {
sources: fstest.Files{
"index.html": `{% var filters = filters default nil %}`,
},
expectedBuildErr: "use of untyped nil",
},
works as expected. The problem seems to be related to this code:
scriggo/internal/compiler/checker_assignment.go
Lines 401 to 413 in aeab4b8
for i, rh := range rhs { | |
for j, ti := range rh { | |
if ti == nil { | |
continue | |
} | |
if ti.Nil() { | |
panic(tc.errorf(subExpr(nodeRhs[i], j == 0), "use of untyped nil")) | |
} | |
if j == 0 || ti.Untyped() { | |
tc.mustBeAssignableTo(ti, subExpr(nodeRhs[i], j == 0), rh[1].Type, false, nil) | |
} | |
} | |
} |
Metadata
Metadata
Assignees
Labels
bugBug: something already implemented does not work as it shouldBug: something already implemented does not work as it shouldtcheckerRelated to type checkerRelated to type checkertemplatesRelated to the templateRelated to the template