diff --git a/lang/interpret_test/TestAstFunc1/polydoubleincludewithtype.graph b/lang/interpret_test/TestAstFunc1/polydoubleincludewithtype.graph new file mode 100644 index 00000000..0a0315fb --- /dev/null +++ b/lang/interpret_test/TestAstFunc1/polydoubleincludewithtype.graph @@ -0,0 +1 @@ +# err: err3: can't unify, invariant illogicality with equals: base kind does not match (2 != 5) diff --git a/lang/interpret_test/TestAstFunc1/polydoubleincludewithtype/main.mcl b/lang/interpret_test/TestAstFunc1/polydoubleincludewithtype/main.mcl new file mode 100644 index 00000000..dbc67bf6 --- /dev/null +++ b/lang/interpret_test/TestAstFunc1/polydoubleincludewithtype/main.mcl @@ -0,0 +1,12 @@ +import "fmt" + +# note that the class can have two separate types for $b +include c1("t1", "hello") # len is 5 +include c1("t2", [13, 42, 0, -37,]) # len is 4 + +# specifying a fixed type for $b is a compile error, because it's sometimes str! +class c1($a, $b []str) { + test $a { + anotherstr => fmt.printf("len is: %d", len($b)), + } +}