Files
Nim/tests/errmsgs/tsubscriptmismatch_legacy.nim
metagn 4a548deb08 proper errors for subscript overloads (#24068)
The magic `mArrGet`/`mArrPut` subscript overloads always match, so if a
subscript doesn't match any other subscript overloads and isn't a
regular language-handled subscript, it creates a fake overload mismatch
error in `semArrGet` that doesn't have any information (gives stuff like
"first mismatch at index: 0" for every single mismatch). Instead of
generating the fake mismatches, we only generate the fake mismatch for
`mArrGet`/`mArrPut`, and process every overload except them as a real
call and get the errors from there.
2024-09-06 11:25:51 +02:00

11 lines
182 B
Nim

discard """
nimout: '''
but expression 'x' is of type: Foo
'''
"""
type Foo = object
let x = Foo()
discard x[1] #[tt.Error
^ type mismatch: got <Foo, int literal(1)>]#