mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
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.
11 lines
182 B
Nim
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)>]#
|