fixes #2760
This commit is contained in:
parent
fe091997aa
commit
f8e805a614
2 changed files with 11 additions and 1 deletions
|
|
@ -439,7 +439,7 @@ proc changeType(c: PContext; n: PNode, newType: PType, check: bool) =
|
||||||
for i in countup(0, sonsLen(n) - 1):
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
changeType(c, n.sons[i], elemType(newType), check)
|
changeType(c, n.sons[i], elemType(newType), check)
|
||||||
of nkPar, nkTupleConstr:
|
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 != tyTuple:
|
||||||
if tup.kind == tyObject: return
|
if tup.kind == tyObject: return
|
||||||
globalError(c.config, n.info, "no tuple type for constructor")
|
globalError(c.config, n.info, "no tuple type for constructor")
|
||||||
|
|
|
||||||
|
|
@ -75,3 +75,13 @@ block tconsts:
|
||||||
|
|
||||||
type MyBoolArr = distinct array[3, bool]
|
type MyBoolArr = distinct array[3, bool]
|
||||||
const barr:MyBoolArr = MyBoolArr([true, false, true])
|
const barr:MyBoolArr = MyBoolArr([true, false, true])
|
||||||
|
|
||||||
|
# bug #2760
|
||||||
|
|
||||||
|
type
|
||||||
|
DistTup = distinct tuple
|
||||||
|
foo, bar: string
|
||||||
|
|
||||||
|
const d: DistTup = DistTup((
|
||||||
|
foo:"FOO", bar:"BAR"
|
||||||
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue