diff --git a/src/tests/encore/basic/functionCast.enc b/src/tests/encore/basic/functionCast.enc new file mode 100644 index 000000000..3cf2acef0 --- /dev/null +++ b/src/tests/encore/basic/functionCast.enc @@ -0,0 +1,11 @@ +def fun() : (String, String) { + ("Hello", "world") +} + +class Main { + def main() : void { + let foo = fun : () -> (String, String); + match foo() with + (h, w) => print("{} {}\n", h, w) + } +} diff --git a/src/tests/encore/basic/functionCast.out b/src/tests/encore/basic/functionCast.out new file mode 100644 index 000000000..802992c42 --- /dev/null +++ b/src/tests/encore/basic/functionCast.out @@ -0,0 +1 @@ +Hello world diff --git a/src/types/Types.hs b/src/types/Types.hs index 3edca3fb8..4ecb3ef13 100644 --- a/src/types/Types.hs +++ b/src/types/Types.hs @@ -375,7 +375,7 @@ typeMapM f ty@CapabilityType{capability} = do f ty{capability = capability'} typeMapM f ty@ArrowType{argTypes, resultType} = do argTypes' <- mapM (typeMapM f) argTypes - resultType' <- f resultType + resultType' <- typeMapM f resultType f ty{argTypes = argTypes' ,resultType = resultType'} typeMapM f ty@TupleType{argTypes} = do