Skip to content
Browse files

[t] Add a failing test for #596 for Class PMC with overridden init

  • Loading branch information...
1 parent 01418e2 commit ea61ae7dff3f89ac9d632088750494d75ffc23ff @leto leto committed
Showing with 62 additions and 0 deletions.
  1. +62 −0 t/pmc/class.t
View
62 t/pmc/class.t
@@ -43,8 +43,55 @@ Tests the Class PMC.
'more does'()
'anon_inherit'()
'method_cache_tt1497'()
+ 'tailcall_with_overridden_init_gh596'()
.end
+.sub 'tailcall_with_overridden_init_gh596'
+ .local pmc clazz, at1, at2, instance1, instance2
+ newclass clazz, ['Foo']
+ addattribute clazz, 'bar'
+
+ null at1
+ at1 = attrs1(clazz)
+ at1 = at1['bar']
+ at1 = at1['name']
+ null instance1
+ instance1 = newinstance1(clazz)
+ instance1.'hello'()
+
+ null at2
+ at2 = attrs2(clazz)
+ at2 = at2['bar']
+ at2 = at2['name']
+ null instance2
+ instance2 = newinstance2(clazz)
+ instance2.'hello'()
+ ok(1, 'tailcall with an overridden init')
+.end
+
+.sub attrs1
+ .param pmc clazz
+ .local pmc at
+ at = clazz.'attributes'()
+ .return(at)
+.end
+
+.sub attrs2
+ .param pmc clazz
+ .tailcall clazz.'attributes'()
+.end
+
+.sub newinstance1
+ .param pmc clazz
+ .local pmc instance
+ instance = clazz.'new'()
+ .return(instance)
+.end
+
+.sub newinstance2
+ .param pmc clazz
+ .tailcall clazz.'new'()
+.end
# L<PDD15/Class PMC API/=item new>
.sub 'new op'
@@ -839,6 +886,21 @@ t_class_meth:
.return($P0)
.end
+.namespace ['Foo']
+
+.sub 'init' :method :vtable
+# diag('Foo.init')
+.end
+
+.sub 'init_pmc' :method :vtable
+ .param pmc value
+# diag('Foo.init')
+.end
+
+.sub hello :method
+# diag('Foo.hello')
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100

0 comments on commit ea61ae7

Please sign in to comment.
Something went wrong with that request. Please try again.