diff options
author | Araq <rumpf_a@web.de> | 2018-10-15 10:43:56 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-10-15 10:43:56 +0200 |
commit | f8e805a6149e271c56dd125d26ad9c33f338269a (patch) | |
tree | 4cd6f2fa56155463654494901251d325a490a3e8 | |
parent | fe091997aa800d414c6b8d994474e666778bd00c (diff) | |
download | Nim-f8e805a6149e271c56dd125d26ad9c33f338269a.tar.gz |
fixes #2760
-rw-r--r-- | compiler/semexprs.nim | 2 | ||||
-rw-r--r-- | tests/distinct/tdistinct.nim | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 660d538ed..78ea82bb9 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -439,7 +439,7 @@ proc changeType(c: PContext; n: PNode, newType: PType, check: bool) = for i in countup(0, sonsLen(n) - 1): changeType(c, n.sons[i], elemType(newType), check) of nkPar, nkTupleConstr: - let tup = newType.skipTypes({tyGenericInst, tyAlias, tySink}) + let tup = newType.skipTypes({tyGenericInst, tyAlias, tySink, tyDistinct}) if tup.kind != tyTuple: if tup.kind == tyObject: return globalError(c.config, n.info, "no tuple type for constructor") diff --git a/tests/distinct/tdistinct.nim b/tests/distinct/tdistinct.nim index d200b3e34..52728fc2b 100644 --- a/tests/distinct/tdistinct.nim +++ b/tests/distinct/tdistinct.nim @@ -75,3 +75,13 @@ block tconsts: type MyBoolArr = distinct array[3, bool] const barr:MyBoolArr = MyBoolArr([true, false, true]) + +# bug #2760 + +type + DistTup = distinct tuple + foo, bar: string + +const d: DistTup = DistTup(( + foo:"FOO", bar:"BAR" +)) |