Commit Graph

470 Commits

Author SHA1 Message Date
Chris Smowton
1835022c84 Extract external file declarations to individual trap files 2022-05-10 19:51:21 +01:00
Ian Lynagh
2551bb58da Kotlin: Add a test of recursive instantiations
This used to cause a stack overflow
2022-05-10 19:51:21 +01:00
Ian Lynagh
0d79dfc412 Kotlin: Add a test of recursive instantiations
This used to cause a stack overflow
2022-05-10 19:51:21 +01:00
Tamas Vajk
7b2b40cc86 Fix type access extraction of nested generic constructor references 2022-05-10 19:51:21 +01:00
Tamas Vajk
46af85621a Add nested generic constructor reference test 2022-05-10 19:51:21 +01:00
Tamas Vajk
5e1ebb2545 Fix generic constructor reference extraction 2022-05-10 19:51:21 +01:00
Tamas Vajk
415fcaf605 Add generic constructor reference test 2022-05-10 19:51:21 +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
eebfe56c95 Extract more type access expressions 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
Tony Torralba
cf5152baa2 Add test for NotNullExpr flow 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
f513fdce7b Accept test changes 2022-05-10 19:51:20 +01:00
Chris Smowton
dc64b536b3 Ensure that initializers are only printed once in a PrintAst run
Otherwise the output becomes a DAG not a tree. Java achieves the same by omitting all PrintAst of `<obinit>` routines.
2022-05-10 19:51:20 +01:00
Chris Smowton
13cd145a76 Retain Member.getInitializer for Kotlin programs
I opt to identify any syntactic initializer. These are broader in scope than Java's member initializers, which are necessarily context-free, whereas in Kotlin the primary constructor's parameters can be referred to.
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
Chris Smowton
789fe971e4 Fix locations and enclosing statement/callable for assignments 2022-05-10 19:51:20 +01:00
Tamas Vajk
67be6a18de Fix generic callable bindings inside invoke methods 2022-05-10 19:51:20 +01:00
Tamas Vajk
6742496fe3 Get type arguments for property/function references 2022-05-10 19:51:20 +01:00
Tamas Vajk
4b55dce0e9 Add generic function and property reference test cases 2022-05-10 19:51:20 +01:00
Tamas Vajk
18812c810c Add PropertyRefExpr QL class, change extraction to use it, and add tests 2022-05-10 19:51:19 +01:00
Tamas Vajk
5fea49a3c9 Merge function and property reference extraction logic in helper class 2022-05-10 19:51:19 +01:00
Tamas Vajk
b4b1976bc4 Add get/set method extraction for property references 2022-05-10 19:51:19 +01:00
Tamas Vajk
4ce813a720 Extract anonymous class for property references (class, constructor, call to constructor, optional parameters) 2022-05-10 19:51:19 +01:00
Tamas Vajk
d057530584 Add property reference tests 2022-05-10 19:51:19 +01:00
Chris Smowton
2d1308980a Remove accidentally committed change 2022-05-10 19:51:19 +01:00
Chris Smowton
9671668782 Remove accidentally committed change 2022-05-10 19:51:19 +01:00
Chris Smowton
dbb7b0bbf0 Update control-flow test expectations 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
Ian Lynagh
d09dff482c Kotlin: Add diagnostics table to the 'trap' test 2022-05-10 19:51:19 +01:00
Ian Lynagh
a512ee7ac1 Kotlin: Extend long-comment test 2022-05-10 19:51:19 +01:00
Ian Lynagh
4454ef7f95 Kotlin: Add tests for long comments 2022-05-10 19:51:18 +01:00
Ian Lynagh
9af99c584e Kotlin: Tweak test 2022-05-10 19:51:18 +01:00
Ian Lynagh
1d824a4e2f Kotlin: Add a test for truncated literals 2022-05-10 19:51:18 +01:00
Chris Smowton
da159d7239 Add test showing assign expressions 2022-05-10 19:51:18 +01:00
Chris Smowton
7cb6e19e44 Extract array update operations
These are of the form arrExpr[indexExpr] op= rhs
2022-05-10 19:51:18 +01:00
Tamas Vajk
d9c72b1c04 Fix changed expected file 2022-05-10 19:51:18 +01:00
Tamas Vajk
ff5bbee75a Change extracted base type of function references 2022-05-10 19:51:18 +01:00
Tamas Vajk
55428c0c3c Update test 2022-05-10 19:51:18 +01:00
Tamas Vajk
42803a161c WIP: add test for reflective calls 2022-05-10 19:51:18 +01:00
Tony Torralba
b626e80a61 Add test for StmtExpr flow 2022-05-10 19:51:18 +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
Chris Smowton
2fb54de269 Extract ordinary array get and set operations as ArrayAccesses, not calls 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