Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Feb 8, 2020
1 parent 9cc993d commit e11d51e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/semexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ proc isOpImpl(c: PContext, n: PNode, flags: TExprFlags): PNode =
else:
res = false
else:
if t1.skipTypes({tyAlias}).kind != tyGenericBody:
if t1.skipTypes({tyGenericInst, tyAlias, tySink, tyDistinct}).kind != tyGenericBody:
maybeLiftType(t2, c, n.info)
else:
#[
Expand Down
11 changes: 11 additions & 0 deletions tests/metatype/ttypetraits.nim
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ block genericHead:
type FooInst = Foo[int, float]
type Foo2 = genericHead(FooInst)
doAssert Foo2 is Foo # issue #13066

block:
type Goo[T] = object
type Moo[U] = object
type Hoo = Goo[Moo[float]]
type Koo = genericHead(Hoo)
doAssert Koo is Goo
doAssert genericParams(Hoo) is (Moo[float],)
doAssert genericParams(Hoo).get(0) is Moo[float]
doAssert genericHead(genericParams(Hoo).get(0)) is Moo

type Foo2Inst = Foo2[int, float]
doAssert FooInst.default == Foo2Inst.default
doAssert FooInst.default.x2 == 0.0
Expand Down

0 comments on commit e11d51e

Please sign in to comment.