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
hiddenmyFunc = (it: String) -> it
result = myFunc is (Int) -> String
It's not possible to typecheck a function type (beyond simply Function). A better behavior here is probably to just throw an error, because it's impossible to know if above expression should be true or false.
However, we should be able to type cast functions. This snippet does not throw, but should:
hiddenmyFunc = (it) -> it
hidden fooFunc: (String) ->String = myFunc
result = (fooFunc as (String) -> String).apply(1)
I'd expect an error like:
–– Pkl Error ––
Expected value of type String, but got type Int.
Value: 1
1 | result = (fooFunc as (String) -> String).apply(1)
^^^^^^
The text was updated successfully, but these errors were encountered:
This snippet this evaluates to
result = true
:It's not possible to typecheck a function type (beyond simply
Function
). A better behavior here is probably to just throw an error, because it's impossible to know if above expression should be true or false.However, we should be able to type cast functions. This snippet does not throw, but should:
I'd expect an error like:
The text was updated successfully, but these errors were encountered: