diff options
author | cooldome <ariabushenko@bk.ru> | 2018-06-12 00:28:09 +0100 |
---|---|---|
committer | cooldome <ariabushenko@bk.ru> | 2018-06-12 00:28:09 +0100 |
commit | a274d77b55ad69d79c1339d5c43f17ce6bec725b (patch) | |
tree | 3384bd3db81551596d3720c42f2c935f9479f77e | |
parent | 7302a8ce7a0cc566c098b29fdb73c5da3b8e6ac0 (diff) | |
download | Nim-a274d77b55ad69d79c1339d5c43f17ce6bec725b.tar.gz |
Fixes
-rw-r--r-- | compiler/ast.nim | 9 | ||||
-rw-r--r-- | tests/exception/texcpt1.nim | 1 |
2 files changed, 4 insertions, 6 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index dd84452f9..03f02de13 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1667,8 +1667,7 @@ proc skipStmtList*(n: PNode): PNode = proc toRef*(typ: PType): PType = ## If ``typ`` is a tyObject then it is converted into a `ref <typ>` and ## returned. Otherwise ``typ`` is simply returned as-is. - let typ = typ.skipTypes({tyAlias, tyGenericInst}) - if typ.kind == tyObject: + if typ.skipTypes({tyAlias, tyGenericInst}).kind == tyObject: result = newType(tyRef, typ.owner) rawAddSon(result, typ) @@ -1676,9 +1675,9 @@ proc toObject*(typ: PType): PType = ## If ``typ`` is a tyRef then its immediate son is returned (which in many ## cases should be a ``tyObject``). ## Otherwise ``typ`` is simply returned as-is. - result = typ.skipTypes({tyAlias, tyGenericInst}) - if result.kind == tyRef: - result = result.lastSon + let t = typ.skipTypes({tyAlias, tyGenericInst}) + if t.kind == tyRef: t.lastSon + else: typ proc isException*(t: PType): bool = # check if `y` is object type and it inherits from Exception diff --git a/tests/exception/texcpt1.nim b/tests/exception/texcpt1.nim index ebbb9d44f..835f3610a 100644 --- a/tests/exception/texcpt1.nim +++ b/tests/exception/texcpt1.nim @@ -1,6 +1,5 @@ discard """ outputsub: "-6" - targets: "c cpp" """ type ESomething = object of Exception |