fix is with generic types; fix genericHead(Foo[T]) (#13303)
* fix #9855, fix #9855, fix genericHead * render TTypeKind via toHumanStr
This commit is contained in:
parent
debe7fffd8
commit
7939319379
7 changed files with 94 additions and 20 deletions
|
|
@ -396,12 +396,21 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
|||
else:
|
||||
res = false
|
||||
else:
|
||||
maybeLiftType(t2, c, n.info)
|
||||
if t1.skipTypes({tyGenericInst, tyAlias, tySink, tyDistinct}).kind != tyGenericBody:
|
||||
maybeLiftType(t2, c, n.info)
|
||||
else:
|
||||
#[
|
||||
for this case:
|
||||
type Foo = object[T]
|
||||
Foo is Foo
|
||||
]#
|
||||
discard
|
||||
var m = newCandidate(c, t2)
|
||||
if efExplain in flags:
|
||||
m.diagnostics = @[]
|
||||
m.diagnosticsEnabled = true
|
||||
res = typeRel(m, t2, t1) >= isSubtype # isNone
|
||||
# `res = sameType(t1, t2)` would be wrong, eg for `int is (int|float)`
|
||||
|
||||
result = newIntNode(nkIntLit, ord(res))
|
||||
result.typ = n.typ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue