You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Dynamic fields are just entirely ignored by the typechecker, which means we can write unsound code that will typecheck but fail at run time (including failing unexpectedly late because contracts issued from static types have been elided).
To Reproduce
$ nickel repl
> :tc (let x = 1 in {"%{x}" = 1, bar = false}) : {_ : Bool}Ok: { _ : Bool }
Expected behavior
I expect that the typechecker correctly ensures that a record with dynamic fields is inferred/checker to be of type {_ : T} for some T and that the fields defined dynamically are actually checked against this type.
Additionally, I expect that the interpolated expressions to be checked to be of type String.
Additional context
I realized this as part of #2121. It's clear from the code that we don't visit dynamic fields at all. This is expected to be fixed by #2121, so not much to do on that front until then.
The text was updated successfully, but these errors were encountered:
Describe the bug
Dynamic fields are just entirely ignored by the typechecker, which means we can write unsound code that will typecheck but fail at run time (including failing unexpectedly late because contracts issued from static types have been elided).
To Reproduce
Expected behavior
I expect that the typechecker correctly ensures that a record with dynamic fields is inferred/checker to be of type
{_ : T}
for someT
and that the fields defined dynamically are actually checked against this type.Additionally, I expect that the interpolated expressions to be checked to be of type
String
.Environment
Additional context
I realized this as part of #2121. It's clear from the code that we don't visit dynamic fields at all. This is expected to be fixed by #2121, so not much to do on that front until then.
The text was updated successfully, but these errors were encountered: