Files
Nim/tests/errmsgs/tsubscriptmismatch.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

12 lines
232 B
Nim

discard """
matrix: "-d:testsConciseTypeMismatch"
nimout: '''
[1] proc `[]`[T; U, V: Ordinal](s: openArray[T]; x: HSlice[U, V]): seq[T]
'''
"""
type Foo = object
let x = Foo()
discard x[1] #[tt.Error
^ type mismatch]#