mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 06:43:52 +00:00
@@ -1899,8 +1899,11 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||
else:
|
||||
result = isNone
|
||||
of tyConcept:
|
||||
result = if concepts.conceptMatch(c.c, f, a, c.bindings, nil): isGeneric
|
||||
else: isNone
|
||||
if a.kind == tyConcept and sameType(f, a):
|
||||
result = isGeneric
|
||||
else:
|
||||
result = if concepts.conceptMatch(c.c, f, a, c.bindings, nil): isGeneric
|
||||
else: isNone
|
||||
of tyCompositeTypeClass:
|
||||
considerPreviousT:
|
||||
let roota = a.skipGenericAlias
|
||||
|
||||
22
tests/concepts/tintypesection.nim
Normal file
22
tests/concepts/tintypesection.nim
Normal file
@@ -0,0 +1,22 @@
|
||||
# issues with concepts in type section types
|
||||
|
||||
block: # issue #22839
|
||||
type
|
||||
Comparable = concept
|
||||
proc `<`(a, b: Self): bool
|
||||
|
||||
# Works with this.
|
||||
# Comparable = concept a
|
||||
# `<`(a, a) is bool
|
||||
|
||||
# Doesn't work with the new style concept.
|
||||
Node[T: Comparable] = object
|
||||
data: T
|
||||
next: ref Node[T]
|
||||
|
||||
var x: Node[int]
|
||||
type NotComparable = object
|
||||
doAssert not (compiles do:
|
||||
var y: Node[NotComparable])
|
||||
proc `<`(a, b: NotComparable): bool = false
|
||||
var z: Node[NotComparable]
|
||||
Reference in New Issue
Block a user