mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
fixes #23397 All ambiguous symbols generate symchoices for call arguments since #23123. So, if a type mismatch receives a symchoice node for an argument, we now treat it as an ambiguous identifier and list the ambiguous symbols in the error message.
28 lines
570 B
Nim
28 lines
570 B
Nim
discard """
|
|
matrix: "-d:testsConciseTypeMismatch"
|
|
"""
|
|
|
|
# bug #8066
|
|
|
|
when true:
|
|
type
|
|
MyEnum {.pure.} = enum
|
|
valueA, valueB, valueC, valueD, amb
|
|
|
|
OtherEnum {.pure.} = enum
|
|
valueX, valueY, valueZ, amb
|
|
|
|
|
|
echo valueA # MyEnum.valueA
|
|
echo MyEnum.amb # OK.
|
|
echo amb #[tt.Error
|
|
^ type mismatch
|
|
Expression: echo amb
|
|
[1] amb: MyEnum | OtherEnum
|
|
|
|
Expected one of (first mismatch at [position]):
|
|
[1] proc echo(x: varargs[typed, `$$`])
|
|
ambiguous identifier: 'amb' -- use one of the following:
|
|
MyEnum.amb: MyEnum
|
|
OtherEnum.amb: OtherEnum]#
|