-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RA22-015: Add test for calls to non callable entities
- Loading branch information
1 parent
3035409
commit 8eb6e10
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
testsuite/tests/contrib/lkt_semantic/call_non_callable/test.lkt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)() |
73 changes: 73 additions & 0 deletions
73
testsuite/tests/contrib/lkt_semantic/call_non_callable/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
Resolving test.lkt | ||
================== | ||
Id <RefId "Int" test.lkt:3:9-3:12> | ||
references <StructDecl prelude: "Int"> | ||
|
||
Id <RefId "Int" test.lkt:3:17-3:20> | ||
references <StructDecl prelude: "Int"> | ||
|
||
Expr <NullLit test.lkt:3:23-3:27> | ||
has type <FunctionType prelude: "(Int) -> Int"> | ||
|
||
Id <RefId "Int" test.lkt:4:17-4:20> | ||
references <StructDecl prelude: "Int"> | ||
|
||
test.lkt:4:23: error: Object of type `Int` is not callable | ||
3 | @invalid val b: Int = a(12)() | ||
| ^^^^^ | ||
|
||
Id <RefId "a" test.lkt:4:23-4:24> | ||
references <ValDecl "a" test.lkt:3:1-3:27> | ||
|
||
Expr <RefId "a" test.lkt:4:23-4:24> | ||
has type <FunctionType prelude: "(Int) -> Int"> | ||
|
||
Expr <NumLit test.lkt:4:25-4:27> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Expr <CallExpr test.lkt:4:23-4:28> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Expr <CallExpr test.lkt:4:23-4:30> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Id <RefId "Int" test.lkt:6:10-6:13> | ||
references <StructDecl prelude: "Int"> | ||
|
||
Id <RefId "Int" test.lkt:6:16-6:19> | ||
references <StructDecl prelude: "Int"> | ||
|
||
Id <RefId "i" test.lkt:6:22-6:23> | ||
references <FunArgDecl "i" test.lkt:6:7-6:13> | ||
|
||
Expr <RefId "i" test.lkt:6:22-6:23> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Expr <NumLit test.lkt:6:26-6:27> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Expr <BinOp test.lkt:6:22-6:27> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Id <RefId "Int" test.lkt:7:17-7:20> | ||
references <StructDecl prelude: "Int"> | ||
|
||
test.lkt:7:23: error: Object of type `Int` is not callable | ||
6 | @invalid val d: Int = a(12)() | ||
| ^^^^^ | ||
|
||
Id <RefId "a" test.lkt:7:23-7:24> | ||
references <ValDecl "a" test.lkt:3:1-3:27> | ||
|
||
Expr <RefId "a" test.lkt:7:23-7:24> | ||
has type <FunctionType prelude: "(Int) -> Int"> | ||
|
||
Expr <NumLit test.lkt:7:25-7:27> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Expr <CallExpr test.lkt:7:23-7:28> | ||
has type <StructDecl prelude: "Int"> | ||
|
||
Expr <CallExpr test.lkt:7:23-7:30> | ||
has type <StructDecl prelude: "Int"> | ||
|
1 change: 1 addition & 0 deletions
1
testsuite/tests/contrib/lkt_semantic/call_non_callable/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
driver: lkt |