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
A generic type can be written with the wrong number of type arguments, or with none, and the checker accepts it.
Repro
let first(r: Result) -> Integer = 1
let f(x: Optional<Integer, String, Bool>) -> Integer = 2
main do
IO.printLine("${first(Ok(1))}")
end
Actual: accepted; prints 1.
Expected:
Optional<Integer, String, Bool>: an error, Optional takes one type argument.
Bare Result in a signature: an error, or a documented meaning. Today it silently matches every Result<A, E>.
Cause
Type arguments are never counted against the declaration. In argMatchesParam, a named type with no arguments on either side matches any instantiation of that name (src/semantic/typechecker_expr.cxx:3694-3700). That rule is used on purpose for make Range style receivers, so the bare form probably has to stay legal there and be rejected elsewhere.
Reproduced on kex 0.4.0-rc.3 (266b7a60) with the type checker on.
Activity