Dmitriy Novozhilov
38fa0122e8
[FIR] Add synthetic else branch to when if it's missing
...
This change is needed for correct work of data flow, because for
non-exhaustive when there is a else branch in terms of control flow
graph.
This change leads to some errors when when is actually exhaustive, but
we still add else branch. Those errors will be gone when exhaustive
checker will be introduced
2019-09-02 10:43:05 +03:00
Mikhail Glukhikh
75c4c88d0a
FIR: set receivers for invoke case more precisely
2019-08-30 11:47:32 +03:00
Mikhail Glukhikh
f0f4ddecc0
FIR: set dispatch receiver for field symbols
2019-08-30 11:47:32 +03:00
Mikhail Glukhikh
bd5e1aeef5
FIR2IR: change backing field visibility to private
2019-08-30 11:47:32 +03:00
Mikhail Glukhikh
652fd7ee73
FIR: fix dispatch receivers for objects
2019-08-30 11:47:31 +03:00
Mikhail Glukhikh
0d5cfa97a5
FIR2IR: read & set dispatch & extension receivers
...
NB: this commit includes receiver-based assertions yet failing for some tests
2019-08-30 11:47:31 +03:00
Mikhail Glukhikh
da22898a19
FIR2IR: set 'SetField' type to Unit, convert explicit 'this' references
2019-08-30 11:47:30 +03:00
Steven Schäfer
a90ac2438d
Set correct field visibility in psi2ir
2019-08-28 19:41:11 +02:00
Mads Ager
6c7a904663
Psi2Ir: Mark accessors with no bodies as default accessors.
...
They are currently marked as defined even when they get a
default implementation. That makes it hard to figure out
if the accessor should be removed when introducing a backing
field in the JVM_IR backend.
2019-08-28 19:25:13 +02:00
Mikhail Glukhikh
c9a600c5ce
FIR: handle imported members from objects more correctly
2019-08-23 17:15:08 +03:00
Mikhail Glukhikh
5d6a526eec
FIR: more accurate handling of dispatch receiver values
...
This commit fixes resolve priorities (see changed test data),
e.g. top-levels now have less priority than implicit receiver members
2019-08-23 17:15:08 +03:00
Dmitriy Novozhilov
e3e1f3c2aa
[FIR] Fix transforming value parameters of anonymous functions
2019-08-22 14:14:55 +03:00
Dmitriy Novozhilov
f1e56c4b3e
[FIR] Force resolving all declaration while resolving of body with implicit type
2019-08-22 14:14:55 +03:00
Dmitriy Novozhilov
e374242adf
[FIR] Fix propagating expected type for binary operator calls
2019-08-22 10:55:07 +03:00
Dmitriy Novozhilov
ba7a137e74
[FIR] Add fir node for binary && and ||
2019-08-22 10:55:07 +03:00
Dmitriy Novozhilov
f877fe40b3
[FIR] Fix expected type in invoke completion
2019-08-22 10:55:07 +03:00
Dmitriy Novozhilov
57a2665b00
[FIR] Update tests for previous commit
2019-08-22 10:55:07 +03:00
Dmitriy Novozhilov
e48959350c
[FIR] Infer type of when expressions and try expressions like it is function call
2019-08-22 10:55:07 +03:00
Dmitriy Novozhilov
e6bf3b3263
[FIR] Render nullability in type renderer, not in fir renderer
2019-08-22 10:55:07 +03:00
Dmitry Petrov
986654b709
psi2ir: fix unsubstituted type parameters around SAM conversions
...
Preserve type substitution:
- when obtaining function type for SAM type;
- when generating SAM conversions for SAM adapter arguments;
- for "original" method corresponding to a SAM adapter.
2019-08-14 14:18:42 +03:00
Dmitry Petrov
7170439517
IR: '!!' is generated as 'CHECK_NOT_NULL' intrinsic
...
```
fun <T : Any> CHECK_NOT_NULL(x: T?): x =
if (x != null) x else throw NullPointerException(...)
```
This allows to compile both Kotlin/JVM and Kotlin/JS effectively.
2019-08-14 11:16:10 +03:00
Dmitry Petrov
1d0ba4edd4
IR: IrTypeAlias: update testData after rebase on master
2019-08-06 12:42:44 +03:00
Dmitry Petrov
bdec8b04e8
Minor: trim in RenderIrElementVisitor
2019-07-31 10:37:35 +03:00
Mikhail Glukhikh
213f951da3
FIR: partial implementation of delegate resolve #KT-32217 Fixed
2019-07-25 09:46:34 +03:00
Mikhail Glukhikh
63b7fa70f9
FIR2IR: add extension receiver parameters to functions
2019-07-25 09:46:29 +03:00
Dmitry Petrov
127be9be03
psi2ir: Fix KT-30796 ErrorType for '?:' in OI
2019-07-22 09:46:21 +03:00
Dmitry Petrov
ffd9b45ef3
IrFunctionExpression: add 'origin'
...
This is actually either a LAMBDA or an ANONYMOUS_FUNCTION.
Not quite sure if it's really required, but some tools such as IR-based
decompiler might require this information.
2019-07-19 11:36:19 +03:00
Dmitry Petrov
41b59f9b9a
IrFunctionExpression: update fir2ir tests
2019-07-19 11:36:19 +03:00
Dmitry Petrov
ed2b4a8bec
Introduce IrFunctionExpression IR element
...
Use it to represent proper function expressions (lambdas and anonymous
functions).
2019-07-19 11:36:18 +03:00
Mikhail Glukhikh
592cf4f4e8
Make FirNamedReferenceWithCandidate not resolved, fix receiver completion
...
Counting it as resolved provokes a lot of difficult to discover errors
2019-07-17 10:45:06 +03:00
Simon Ogorodnik
1222449dc8
FIR resolve: perform inference completion for property access
2019-07-17 10:45:06 +03:00
Mikhail Glukhikh
2d74dac4f2
FIR: set constructor parameter scope correctly for designated transformer
2019-07-17 10:45:05 +03:00
Dmitry Petrov
6963424dfc
psi2ir: Empty 'if' branches have type 'kotlin.Unit'
2019-07-15 08:58:04 +03:00
Mikhail Glukhikh
43c6049f02
FIR2IR: set origin correctly for synthetic property accesses
2019-07-11 12:46:48 +03:00
Mikhail Glukhikh
c6a09dba4e
FIR: consider Java default constructors as primary ones
2019-07-11 12:40:29 +03:00
Mikhail Glukhikh
c35d7eab70
Refactor FIR symbols to make them and their FIR element types more clear
...
This commit also fixes work with Java synthetic properties
2019-07-11 12:37:32 +03:00
Mikhail Glukhikh
d96c66adac
FIR: partially implement invoke resolution
2019-07-08 16:59:37 +03:00
Igor Chevdar
e8ac22e238
Fixed some IR tests on enums
2019-06-27 19:04:01 +03:00
Dmitry Petrov
b3b7e26985
Make InsertImplicitCasts work with Descriptors and KotlinTypes again
...
This is a temporary change to make sure IrType infrastructure work is in
master.
It causes some of irText tests to work incorrectly (as in master).
2019-06-26 10:07:13 +03:00
Dmitry Petrov
339291b01f
psi2ir: update testData
2019-06-26 09:39:16 +03:00
Dmitry Petrov
1d9cb39915
psi2ir: fix nullability assertion generation for platform types
...
Incorporate PR from Steven Schäfer into IrType-based implicit cast
insertion (commit 17b925636e8717e7648c5d7b792c6ab4d18f776d).
NB this still uses originalKotlinType to determine if the type was
nullability flexible. It is somewhat error-prone and something we want
to get rid of. However, it boils down to some design questions related
to implicit null checks in Kotlin - e.g., it might be Ok to just treat
nullability flexible type `T!` as `T?` in IR, generate null checks for
all usages of type `T?` where a non-null type is expected, and later
eliminate the null checks that are redundant according to the (quite
conservative) criterion in the redundant null check elimination.
2019-06-26 09:39:16 +03:00
Mikhail Glukhikh
d41c50d6cf
FIR: support type inference for assignments, fix related lambda inference
2019-06-24 18:51:03 +03:00
Mikhail Glukhikh
ca401cb01d
FIR2IR: support backing field symbols from FIR, fix test data
2019-06-20 15:26:40 +03:00
Mikhail Glukhikh
54078c4e9c
FIR resolve: support inferring property type from getter
2019-06-20 15:26:39 +03:00
Mikhail Glukhikh
b7da2f2ad8
FIR resolve: check early receivers on kotlin.* only
...
To provide more stable behaviour, the check introduced in the previous
commit is now applied only to extensions from kotlin.* package.
2019-06-19 22:48:52 +03:00
Ting-Yuan Huang
1b4d26e490
psi2ir: keep the type of when when possible
...
Ideally, the type of `IrWhen` should be provided by type inference for
a consistent behavior. `USED_AS_EXPRESSION` from CFG isn't always
consistent with type inference, unfortunately.
The behavior is now aligned with `if`. The type of `when` is kept when
it *can* be an expression, instead of whether it is used or not.
2019-06-05 10:23:44 +02:00
Mikhail Glukhikh
2db8409d85
FIR: introduce & resolve spread named arguments #KT-31575 Fixed
2019-05-28 10:20:42 +03:00
Mikhail Glukhikh
d0404b2c2a
FIR resolve: check number of parameters when handling Java accessors
2019-05-28 10:20:38 +03:00
Mikhail Glukhikh
d2bdbd8978
FIR resolve: record & check implicit extension receiver type properly
2019-05-28 10:20:35 +03:00
Simon Ogorodnik
58873b2d7b
FIR resolve: set setter value-parameter type properly
2019-05-28 10:17:57 +03:00