Tamas Vajk
222f2415e2
Fix local function reference extraction
2022-05-10 19:51:24 +01:00
Chris Smowton
2ea1a6c1f0
Adjust test expectations
...
These all just refer to re-adding empty blocks for classes whose constructors have no initializer statements for simplicity's sake.
2022-05-10 19:51:24 +01:00
Tamas Vajk
b26044b327
Change extension receiver this access to be a parameter access
2022-05-10 19:51:23 +01:00
Tamas Vajk
21f6867cd4
Add test cases for delegating properties to other properties
2022-05-10 19:51:23 +01:00
Tamas Vajk
90ca47a46b
Extract local delegated property reference
2022-05-10 19:51:23 +01:00
Tamas Vajk
a7e6ec9d02
Add test case for delegated properties initialized through provideDelegate operator
2022-05-10 19:51:22 +01:00
Tamas Vajk
a3992950b1
Add delegated property call tests
2022-05-10 19:51:22 +01:00
Tamas Vajk
126d780f34
Add delegated property declaration test
2022-05-10 19:51:22 +01:00
Tony Torralba
64531dd717
Fix AST representation of WhenExpr and WhenBranch
2022-05-10 19:51:22 +01:00
Tamas Vajk
d4701d72d9
Add DelegatedProperty QL class and use it in tests
2022-05-10 19:51:22 +01:00
Tamas Vajk
78b4c9403d
Add lazy local delegated property test case
2022-05-10 19:51:22 +01:00
Tamas Vajk
f8343b8cc7
Extract local delegated properties
2022-05-10 19:51:22 +01:00
Tamas Vajk
2d0bb43efe
Do not extract local function containers as anonymous classes
2022-05-10 19:51:22 +01:00
Tamas Vajk
9597932112
Add test that calls a local function multiple times
2022-05-10 19:51:22 +01:00
Tamas Vajk
a8f595c50a
Refactor type access extraction
2022-05-10 19:51:21 +01:00
Tamas Vajk
92e59a3ae1
Add SAM conversion tests
2022-05-10 19:51:21 +01:00
Tamas Vajk
a70ade224f
Fix (generic) type access extraction for lambdas
2022-05-10 19:51:21 +01:00
Tamas Vajk
4af12e7c9d
Change array.get calls to array indexing in FunctionN.invoke body
2022-05-10 19:51:20 +01:00
Tamas Vajk
4e18974889
Fix type access expression extraction for function/property references
2022-05-10 19:51:20 +01:00
Chris Smowton
73c5f8c591
Accept more test changes
2022-05-10 19:51:20 +01:00
Chris Smowton
37543e7a86
Switch to expanding property initializers and init blocks in-place
...
Pros:
* <obinit> no longer emitted: one less function per class
* Parameters to the primary constructor, if any, are no longer referred to out of scope
* Simple primary constructor `val` and `var` declarations work as expected
Cons:
* If there are multiple secondary constructors, no primary constructor and long init blocks, there could be considerable duplicate extraction of those init blocks. Hopefully this case is very rare.
2022-05-10 19:51:20 +01:00
Chris Smowton
8d8a2482f1
Accept test changes
...
These are just ordering changes because the bounds of assignment statements relative to their operands have changed.
2022-05-10 19:51:20 +01:00
Tamas Vajk
5fea49a3c9
Merge function and property reference extraction logic in helper class
2022-05-10 19:51:19 +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
Chris Smowton
8af0f26411
Extract simple in-place operators
...
Complex in-place operators (someFieldOrArrayCell += e) get a harder-to-parse lowering which needs to be intercepted at the IrBlock level
2022-05-10 19:51:18 +01:00
Tamas Vajk
6154c2be18
Change arguments of big arity invoke call
2022-05-10 19:51:18 +01:00
Tamas Vajk
3f2c275e5f
Fix functional interface selection
2022-05-10 19:51:18 +01:00
Tamas Vajk
46bd6b096e
Add big arity SAM conversion test case
2022-05-10 19:51:18 +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
7368b49b16
Implement Any?.String using java.lang.String.valueOf
...
This is how kotlinc does it, and doesn't involve an unchecked null deref like the existing use of Object.toString.
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
4adf5829e4
Fix expected files
2022-05-10 19:51:16 +01:00
Ian Lynagh
579c590ea6
Kotlin: Accept test changes following "casting" operator changes
2022-05-10 19:51:13 +01:00
Tamas Vajk
afd71a00d0
Fix extraction of function references without dispatch receiver
2022-05-10 19:51:12 +01:00
Tamas Vajk
1e64887903
Extract field receiver in field read/write
2022-05-10 19:51:11 +01:00
Tamas Vajk
10ae157682
Extract function references
2022-05-10 19:51:11 +01:00
Tamas Vajk
6950f868fb
Fix type access extraction in field declarations
2022-05-10 19:51:11 +01:00
Tamas Vajk
e5003e4032
Adjust PrintAST query to handle kotlin constructs
2022-05-10 19:51:11 +01:00
Tamas Vajk
73cd497427
Add todo comment to move property from parameter initialization to constructor
2022-05-10 19:51:11 +01:00
Tamas Vajk
313912a131
Fix test expected files
2022-05-10 19:51:11 +01:00
Chris Smowton
ef9a213ae1
Cleanup: use extractTypeAccess wherever possible
2022-05-10 19:51:11 +01:00
Tamas Vajk
9d7794185e
Fix temporary variable locations
2022-05-10 19:51:11 +01:00
Tamas Vajk
67d2c52e86
Extract field declarations
2022-05-10 19:51:11 +01:00
Tamas Vajk
6455c988f2
Extract class references
2022-05-10 19:51:11 +01:00
Chris Smowton
0c7075c749
Give getters and setters their jvm-lowered names
2022-05-10 19:51:10 +01:00
Chris Smowton
25674247a2
Accept test changes relating to generic constructors
2022-05-10 19:51:10 +01:00