summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-14 19:51:23 +0800
committerGitHub <noreply@github.com>2020-11-14 12:51:23 +0100
commit47ce24f680dbf5aed8cd393f011739ea5d7a9928 (patch)
tree85d542b7e08c3e1296d52b082efd1cad57185d5f /tests
parent784720a7efc5c2b722be51c26a06ade0f4f11aaa (diff)
downloadNim-47ce24f680dbf5aed8cd393f011739ea5d7a9928.tar.gz
fix #12303 (#15964)
Diffstat (limited to 'tests')
-rw-r--r--tests/js/t12303.nim16
-rw-r--r--tests/varres/tvarres0.nim3
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/js/t12303.nim b/tests/js/t12303.nim
new file mode 100644
index 000000000..270d82ced
--- /dev/null
+++ b/tests/js/t12303.nim
@@ -0,0 +1,16 @@
+discard """
+  output: "{ b: 2 }"
+"""
+
+import jsconsole, jsffi
+
+type
+  A = ref object
+   b: B
+
+  B = object
+    b: int
+
+var a = cast[A](js{})
+a.b = B(b: 2)
+console.log a.b
diff --git a/tests/varres/tvarres0.nim b/tests/varres/tvarres0.nim
index 0f89c7e71..94bdb4a06 100644
--- a/tests/varres/tvarres0.nim
+++ b/tests/varres/tvarres0.nim
@@ -4,6 +4,7 @@ discard """
 123
 1234
 12345
+123456
 '''
 """
 
@@ -28,6 +29,8 @@ getF().a = 1234
 echo getF().a
 getF() = Foo(a: 12345)
 echo getF().a
+(addr getF())[] = Foo(a: 123456)
+echo getF().a
 
 
 block: # #13848