Commit Graph

30 Commits

Author SHA1 Message Date
Tamas Vajk
3af8273620 Modify extraction of &&/|| to resugar it from when expression 2022-05-10 19:51:30 +01:00
Tamas Vajk
5a5d0e15eb Extract calls to big-arity lambda's invoke by converting the artificial invoke to the existing one
Big arity lambda calls in IR look like standard method calls to an `invoke` with N arguments. However, this method doesn't exist in JVM, so instead we need to extract a call to `FunctionN.invoke(Object[])`.
2022-05-10 19:51:24 +01:00
Tamas Vajk
92e59a3ae1 Add SAM conversion tests 2022-05-10 19:51:21 +01:00
Chris Smowton
5fe65ed983 Extract no-when-branch-found calls
These are extracted as "throw new kotlin.NoWhenBranchFoundException();", which is the Java lowering of the intrinsic.

In the process, amend the control-flow graph to let when branches propagate `throw`s outwards, and similarly statement expressions.
2022-05-10 19:51:19 +01:00
Tamas Vajk
a598c7fc0c Rework SAM conversion extraction (handle arbitrary expression that's being converted) 2022-05-10 19:51:17 +01:00
Tamas Vajk
34ae00fa62 Extract SAM lambda conversion 2022-05-10 19:51:17 +01:00
Chris Smowton
377a0f91f0 Add missing times operator 2022-05-10 19:51:17 +01:00
Chris Smowton
f6db91f294 Update test expectations 2022-05-10 19:51:17 +01:00
Chris Smowton
a120fab9f7 Complete implementation of equality tests
- Create a new operator representing an infix value [in]equality test, equivalent to Objects.equals(lhs, rhs)
- Continue to use simple equality where it is clearly possible at the callsite
- Note that ieee754equals is the same as Java's == and != operators
2022-05-10 19:51:17 +01:00
Chris Smowton
377bd8f2e9 Extract String?.plus as either an AddExpr or a call to an intrinsic
If it is used by the compiler to implement the infix plus operator, resugar it and extract a `+` as Java would. If it is literally called by the user (e.g. `(if (x) then "not null" else null).plus(something)`), then extract a call to the real method Intrinsics.stringPlus (a two-arg static method).
2022-05-10 19:51:16 +01:00
Tamas Vajk
afd71a00d0 Fix extraction of function references without dispatch receiver 2022-05-10 19:51:12 +01:00
Chris Smowton
0c7075c749 Give getters and setters their jvm-lowered names 2022-05-10 19:51:10 +01:00
Tamas Vajk
f4c87cb79d Extract function expressions 2022-05-10 19:51:09 +01:00
Tamas Vajk
16ba27c476 Extract local functions 2022-05-10 19:51:08 +01:00
Ian Lynagh
669fe616dd Kotlin: Renumber lines in expressions test 2022-05-10 19:51:07 +01:00
Ian Lynagh
1abaecf158 Kotlin: String templates are already supported 2022-05-10 19:51:07 +01:00
Tamas Vajk
23c5caadc8 Fix String?.plus extraction 2022-05-10 19:51:06 +01:00
Tamas Vajk
ea4e919af5 Extract missing functions directly in kotlin package 2022-05-10 19:51:06 +01:00
Ian Lynagh
3e9d12aff0 Kotlin: Accept test changes 2022-05-10 19:51:05 +01:00
Ian Lynagh
2d8a2abe5c Kotlin: Recognise more numeric types 2022-05-10 19:51:05 +01:00
Ian Lynagh
76151b413f Kotlin: Add more Long tests 2022-05-10 19:51:05 +01:00
Ian Lynagh
6b5fe14e94 Kotlin: Add tesets for more integer types 2022-05-10 19:51:05 +01:00
Ian Lynagh
1b40f78b9c Kotlin: Recognise + etc for Double 2022-05-10 19:51:05 +01:00
Ian Lynagh
5b5a6042a9 Kotlin: Add tests for more Double operators 2022-05-10 19:51:05 +01:00
Tamas Vajk
b7e0828f78 Extract anonymous object creation 2022-05-10 19:51:05 +01:00
Ian Lynagh
10004c77d1 Kotlin: some TODO stuff works now 2022-05-10 19:51:05 +01:00
Ian Lynagh
a3e70fdb5c Kotlin: Add support for ieee754equals 2022-05-10 19:51:05 +01:00
Ian Lynagh
78d2ef52c1 Kotlin: Towards better equality checking 2022-05-10 19:51:05 +01:00
Ian Lynagh
5da15ca03b Kotlin: Resugar != 2022-05-10 19:51:04 +01:00
Ian Lynagh
744f3db68d Kotlin: Handle binops correctly 2022-05-10 19:51:04 +01:00