From 8eb6e10deb76f4789fab24555dc5e1d3a2200d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20AMIARD?= Date: Mon, 27 Sep 2021 15:58:26 +0200 Subject: [PATCH] RA22-015: Add test for calls to non callable entities --- .../lkt_semantic/call_non_callable/test.lkt | 7 ++ .../lkt_semantic/call_non_callable/test.out | 73 +++++++++++++++++++ .../lkt_semantic/call_non_callable/test.yaml | 1 + 3 files changed, 81 insertions(+) create mode 100644 testsuite/tests/contrib/lkt_semantic/call_non_callable/test.lkt create mode 100644 testsuite/tests/contrib/lkt_semantic/call_non_callable/test.out create mode 100644 testsuite/tests/contrib/lkt_semantic/call_non_callable/test.yaml diff --git a/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.lkt b/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.lkt new file mode 100644 index 000000000..873b687f0 --- /dev/null +++ b/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.lkt @@ -0,0 +1,7 @@ +# Error for trying to call a non callable + +val a: (Int) -> Int = null +@invalid val b: Int = a(12)() + +fun c(i: Int): Int = i + 2 +@invalid val d: Int = a(12)() diff --git a/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.out b/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.out new file mode 100644 index 000000000..bdbee544f --- /dev/null +++ b/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.out @@ -0,0 +1,73 @@ +Resolving test.lkt +================== +Id + references + +Id + references + +Expr + has type Int"> + +Id + references + +test.lkt:4:23: error: Object of type `Int` is not callable +3 | @invalid val b: Int = a(12)() + | ^^^^^ + +Id + references + +Expr + has type Int"> + +Expr + has type + +Expr + has type + +Expr + has type + +Id + references + +Id + references + +Id + references + +Expr + has type + +Expr + has type + +Expr + has type + +Id + references + +test.lkt:7:23: error: Object of type `Int` is not callable +6 | @invalid val d: Int = a(12)() + | ^^^^^ + +Id + references + +Expr + has type Int"> + +Expr + has type + +Expr + has type + +Expr + has type + diff --git a/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.yaml b/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.yaml new file mode 100644 index 000000000..7695167b5 --- /dev/null +++ b/testsuite/tests/contrib/lkt_semantic/call_non_callable/test.yaml @@ -0,0 +1 @@ +driver: lkt