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
template return type is ignored in type check when template called inside a generic, and it accepts invalid code.
Example 1
templatebar(t): string=high(t)
procfun[A](key: A) =var h =1andbar(@[1])
fun(0)
# if calling `var h = 1 and bar(@[1])` directly (not inside a generic), we get a correct error msg
Current Output 1
compiles
Expected Output 1
Error: type mismatch: got <int> but expected 'string'
Example 2
templatebar(t): string=high(t)
procfun[A](key: A) =var h =1'uandbar(@[1])
fun(0)
Current Output 2
Error: type mismatch: got <uint, int>
but expected one of:
proc `and`(x, y: uint): uint
first type mismatch at position: 2
required type for y: uint
but expression 'high(@[1])' is of type: int
proc `and`(x, y: uint64): uint64
first type mismatch at position: 2
required type for y: uint64
but expression 'high(@[1])' is of type: int
10 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them
expression: 1'u and high(@[1])
var h = 1'u and bar(@[1])
Expected Output 2
Error: type mismatch: got <int> but expected 'string'
template return type is ignored in type check when template called inside a generic, and it accepts invalid code.
Example 1
Current Output 1
compiles
Expected Output 1
Error: type mismatch: got <int> but expected 'string'
Example 2
Current Output 2
Expected Output 2
Error: type mismatch: got <int> but expected 'string'
Additional Information
The text was updated successfully, but these errors were encountered: