Skip to content

Commit

Permalink
test using type node for object constr type
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Jan 22, 2025
1 parent 793baf3 commit 7b7e6c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/semobjconstr.nim
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ proc defaultConstructionError(c: PContext, t: PType, info: TLineInfo) =
proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType = nil): PNode =
var t = semTypeNode(c, n[0], nil)
result = newNodeIT(nkObjConstr, n.info, t)
for i in 0..<n.len:
result.add newNodeIT(nkType, n[0].info, t)
for i in 1..<n.len:
result.add n[i]

if t == nil:
Expand Down
8 changes: 8 additions & 0 deletions tests/template/tgenericobjconstr.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# issue #24631

type
V[d: static bool] = object
l: int

template y(): V[false] = V[false](l: 0)
discard y()

0 comments on commit 7b7e6c3

Please sign in to comment.