-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into add-gcc-14-compatibility-job
- Loading branch information
Showing
6 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tests/lang_objects/destructor/ttuple_hook_synthesis_issue.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
discard """ | ||
description: ''' | ||
Ensure that hook synthesis considers ``(A, (B, C))`` different from | ||
``(A, (B,), C)``. | ||
''' | ||
output: "3\n4\n1\n2\n" | ||
knownIssue.js vm: "seq destructors don't work yet" | ||
""" | ||
|
||
type Object = object | ||
val: int | ||
|
||
proc `=destroy`(x: var Object) = | ||
echo x.val | ||
|
||
# a seq is only used for testing purposes, since it caused misbehaviour at | ||
# run-time. Using ``(Object, (Object,) Object)`` and | ||
# ``(Object, (Object, Object))`` also led to the same issue, but ran | ||
# "correctly" due to both types having the same in-memory layout | ||
type | ||
Tup1 = (seq[(Object,)], Object) | ||
Tup2 = (seq[(Object, Object)],) | ||
|
||
proc test() = | ||
var x: Tup1 = (@[(Object(val: 1),)], Object(val: 2)) | ||
var y: Tup2 = (@[(Object(val: 3), Object(val: 4))],) | ||
# both locations were treated as having type `Tup1` by the called | ||
# destructor, resulting in either crashes or the wrong output being produced | ||
|
||
test() |