Kotlin: Add a test for type equivalences

This commit is contained in:
Ian Lynagh
2021-11-30 00:51:22 +00:00
parent 606b36e21f
commit 6c1439c180
3 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
| type_equivalences.kt:4:1:4:65 | fooUnit | file://:0:0:0:0 | void | 0 | type_equivalences.kt:4:13:4:19 | x | file://:0:0:0:0 | void |
| type_equivalences.kt:4:1:4:65 | fooUnit | file://:0:0:0:0 | void | 1 | type_equivalences.kt:4:22:4:33 | y | type_equivalences.kt:2:1:2:15 | Par<Void> |
| type_equivalences.kt:5:1:5:65 | fooVoid | file:///modules/java.base/java/lang/Void.class:0:0:0:0 | Void | 0 | type_equivalences.kt:5:13:5:19 | x | file:///modules/java.base/java/lang/Void.class:0:0:0:0 | Void |
| type_equivalences.kt:5:1:5:65 | fooVoid | file:///modules/java.base/java/lang/Void.class:0:0:0:0 | Void | 1 | type_equivalences.kt:5:22:5:33 | y | type_equivalences.kt:2:1:2:15 | Par<Void> |
| type_equivalences.kt:6:1:6:80 | fooNothing | file:///modules/java.base/java/lang/Void.class:0:0:0:0 | Void | 0 | type_equivalences.kt:6:16:6:25 | x | file:///modules/java.base/java/lang/Void.class:0:0:0:0 | Void |
| type_equivalences.kt:6:1:6:80 | fooNothing | file:///modules/java.base/java/lang/Void.class:0:0:0:0 | Void | 1 | type_equivalences.kt:6:28:6:42 | y | type_equivalences.kt:2:1:2:15 | Par<Void> |
| type_equivalences.kt:7:1:7:60 | fooInt | file://:0:0:0:0 | int | 0 | type_equivalences.kt:7:12:7:17 | x | file://:0:0:0:0 | int |
| type_equivalences.kt:7:1:7:60 | fooInt | file://:0:0:0:0 | int | 1 | type_equivalences.kt:7:20:7:30 | y | type_equivalences.kt:2:1:2:15 | Par<Integer> |

View File

@@ -0,0 +1,8 @@
class Par<T> {}
fun fooUnit(x: Unit, y: Par<Unit>): Unit { return fooUnit(x, y) }
fun fooVoid(x: Void, y: Par<Void>): Void { return fooVoid(x, y) }
fun fooNothing(x: Nothing, y: Par<Nothing>): Nothing { return fooNothing(x, y) }
fun fooInt(x: Int, y: Par<Int>): Int { return fooInt(x, y) }

View File

@@ -0,0 +1,7 @@
import java
from Method m, int i, Parameter p
where m.getName().matches("foo%")
and p = m.getParameter(i)
select m, m.getReturnType(), i, p, p.getType()