Tests are added by the method generate_empty_iroutine of MMSignature
Not that tests are systematic even in the safe case (call on self).
Some unsafe places remain, like parameters in closure definitions or
in unsafe assignments.
test_variance_params is updated to reflect the fix.
Signed-off-by: Jean Privat <jean@pryen.org>
13 files changed:
end
iroutine.closure_decls = clos
end
+ # Add automatic test for virtual types
+ var icb = new ICodeBuilder(recv.mmmodule, iroutine)
+ for i in [0..arity[ do
+ var t = self[i]
+ if t isa MMVirtualType then
+ icb.add_type_cast(args[i+1], t)
+ end
+ end
return iroutine
end
end
iroutine.closure_decls = clos
end
+ # TODO: add automatic test for virtual types?
return iroutine
end
end
+++ /dev/null
-AB5
-B5
-5
-AB5
-5
-5
-5
-5
-5
-B5
-5
-5
-5
-5
-5
-5
-5
-5
--- /dev/null
+AB5
+B5
+5
+Cast failed (alt/test_variance_param_alt1.nit)
+++ /dev/null
-AB5
-B5
-5
-B5
-B5
-5
-5
-5
-5
-B5
-5
-5
-5
-5
-5
-5
-5
-5
--- /dev/null
+AB5
+B5
+5
+B5
+Cast failed (alt/test_variance_param_alt2.nit)
+++ /dev/null
-AB5
-B5
-5
-B5
-5
-5
-A5
-5
-5
-B5
-5
-5
-5
-5
-5
-5
-5
-5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+Cast failed (alt/test_variance_param_alt3.nit)
+++ /dev/null
-AB5
-B5
-5
-B5
-5
-5
-B5
-5
-5
-B5
-5
-5
-5
-5
-5
-5
-5
-5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+Cast failed (alt/test_variance_param_alt4.nit)
+++ /dev/null
-AB5
-B5
-5
-B5
-5
-5
-5
-B5
-5
-B5
-5
-5
-5
-5
-5
-5
-5
-5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+5
+Cast failed (alt/test_variance_param_alt5.nit)
+++ /dev/null
-AB5
-B5
-5
-B5
-5
-5
-5
-5
-5
-B5
-5
-5
-B5
-5
-5
-5
-5
-5
--- /dev/null
+AB5
+B5
+5
+B5
+5
+5
+5
+5
+5
+B5
+5
+5
+Cast failed (alt/test_variance_param_alt6.nit)