Commit Graph

487 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 8614323f80 [FIR] Tests. Update some outdated testdata 2019-09-13 12:21:59 +03:00
Dmitry Petrov cb13dd3cdd Add psi2ir tests for 'break' and 'continue' inside 'when' 2019-09-12 15:11:01 +03:00
Mads Ager 90a37617a4 [JVM_IR, IR] Remove more needless temporary variables.
Avoid using a separate origin for temporary variables introduced
for for loops. That doesn't add anything and gives one more case
for optimizations to deal with.

Extend the JVM specific optimizations to remove temporary
variables to deal with more cases encountered in for loops
lowering.
2019-09-11 10:07:45 +02:00
Mikhail Glukhikh 98f72e58bd FIR deserializer: use class type parameters in constructor directly
This allows calls like Pair(...) to be resolved correctly
2019-09-05 16:26:15 +03:00
Mikhail Glukhikh 6a7ebe8928 FIR substitution: do not create fake overrides if types aren't changed 2019-09-05 16:26:14 +03:00
Mikhail Glukhikh 5386cfe254 FIR2IR: support fake overridden properties 2019-09-05 16:26:14 +03:00
Mikhail Glukhikh 687db20029 FIR: support fake overrides for properties 2019-09-05 16:26:14 +03:00
Mikhail Glukhikh 5741ff5d86 FIR: split default importing scopes into low/high priority ones
This fixes resolve of StringBuilder(), AssertionError(), etc.
2019-09-05 16:26:14 +03:00
Dmitriy Novozhilov 5c29af4b53 [FIR] Tests. Update some outdated FIR testdata 2019-09-02 10:43:10 +03:00
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 0962755fde FIR2IR: drop field receiver consistency check (due to delegate field case) 2019-08-30 11:47:33 +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 29b406c731 FIR: set dispatch receiver for backing field access 2019-08-30 11:47:31 +03:00
Mikhail Glukhikh 13d14df8ae FIR: set dispatch receiver for data class generated functions 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
Mikhail Glukhikh 6f785ec881 FIR2IR: fix library annotation call generation 2019-08-22 18:55:10 +03:00
Mikhail Glukhikh 27ccff12c1 FIR: add resolve for delegated super-type
This commit fixes FIR modularized resolve test on whole Kotlin project
(without it we had empty super-type set with delegated super-types)
2019-08-22 18:53:15 +03:00
Dmitriy Novozhilov e3e1f3c2aa [FIR] Fix transforming value parameters of anonymous functions 2019-08-22 14:14:55 +03:00
Dmitriy Novozhilov d841090866 [FIR] Don't analyze properties with implicit types twice
Test `cast.kt` now don't work absolutely correct and implicit type of
  value parameter in lambda is't replaced with error type, but it's
  minor bug
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 908b6ade1d [FIR] Fix incorrect do-while loop transforming order and IR generating 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 637fb55a7b [FIR] Add implementation of intersection types to Fir type system 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
Dmitriy Novozhilov 6e2958880b [FIR] Add forgotten replacing arguments in abbreviated type expansion 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 6abb0ffe28 IR: IrTypeAlias: Update FIR2IR testData
NB a lot of FIR2IR tests actually don't pass, and we don't care much at
the moment.
2019-08-06 12:42:02 +03:00
Dmitry Petrov 48ae76ac28 IR: Introduce IrTypeAlias element 2019-08-06 12:42:02 +03:00
Dmitry Petrov bdec8b04e8 Minor: trim in RenderIrElementVisitor 2019-07-31 10:37:35 +03:00
Mikhail Glukhikh d32e5065c5 FIR: implementation of delegateProvider in delegate resolve 2019-07-25 09:46:42 +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