mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 10:52:14 +00:00
@@ -1293,7 +1293,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||
inc(c.inheritancePenalty, depth)
|
||||
result = isSubtype
|
||||
of tyDistinct:
|
||||
skipOwned(a)
|
||||
a = a.skipTypes({tyOwned, tyGenericInst, tyRange})
|
||||
if a.kind == tyDistinct:
|
||||
if sameDistinctTypes(f, a): result = isEqual
|
||||
#elif f.base.kind == tyAnything: result = isGeneric # issue 4435
|
||||
|
||||
@@ -6,6 +6,7 @@ false
|
||||
false
|
||||
false
|
||||
false
|
||||
Foo
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -98,3 +99,10 @@ proc `<=`(a, b: Id): bool {.borrow.}
|
||||
var xs: array[Id, bool]
|
||||
|
||||
for x in xs: echo x # type mismatch: got (T) but expected 'bool'
|
||||
|
||||
# bug #11715
|
||||
|
||||
type FooD = distinct int
|
||||
proc `<=`(a, b: FooD): bool {.borrow.}
|
||||
|
||||
for f in [FooD(0): "Foo"]: echo f
|
||||
|
||||
Reference in New Issue
Block a user