Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compiler/sigmatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,10 @@ proc enterConceptMatch(c: var TCandidate; f,a: PType, flags: TTypeRelFlags): TTy
if concpt.kind != tyConcept:
container = concpt
concpt = container.reduceToBase
# considerPreviousT-like behavior
let prev = lookup(c.bindings, concpt)
if prev != nil:
return typeRel(c, prev, a, flags)
if trDontBind in flags:
conceptFlags.incl mfDontBind
if trCheckGeneric in flags:
Expand Down
28 changes: 28 additions & 0 deletions tests/concepts/conceptv2negative/tconsistentparams.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
discard """
action: "reject"
errormsg: "type mismatch"
"""

type
Dollarable = concept
proc `$`(x: Self): string

proc checkEqual(x, y: Dollarable) =
if x != y:
echo $x
echo $y

type
StateFlags = enum
sfMatch
sfSoft

MatchKind = enum
NoFurtherMatch
NoMatch
Match
AllFurtherMatch

proc `==`(a: set[StateFlags]; b: MatchKind): bool = true

checkEqual({sfMatch, sfSoft}, Match)