Commit Graph

464 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 3658bee253 [FIR] Fix testdata related to callable references 2019-10-29 13:03:13 +03:00
Dmitriy Novozhilov b93357be48 [FIR] Support assignment operators 2019-10-29 13:03:13 +03:00
Denis Zharkov ea43d2880c FIR: Update FIR2IR test data changed because of callable references
^KT-32725 Fixed
2019-10-28 17:07:26 +03:00
Steven Schäfer 210c354ae5 Fir2Ir: Set initializers for temporary variables 2019-10-25 14:27:19 +03:00
Dmitry Petrov eebb071ae9 KT-34509 Properly unwrap callable reference descriptor
NB there's a problem with callable references to SAM constructors,
see also KT-16789
2019-10-22 12:30:15 +03:00
Dmitry Petrov 1d229b6dca FIR2IR: isExpect 2019-10-21 13:04:59 +03:00
Dmitry Petrov 6532f29cc6 IR: isExpect 2019-10-21 13:04:59 +03:00
Dmitriy Novozhilov 4df4c58a05 [FIR] Resolve type of when expression to Unit if it is not exhaustive 2019-10-21 11:59:44 +03:00
Dmitriy Novozhilov f19a878948 [FIR] Add exhaustive checker for when expressions
Also remove generating default else branch introduced in 38fa0122 and 54eb4cf9
2019-10-17 16:20:59 +03:00
Mads Ager 92cf521e11 [IR] Deal with forward references in default argument lambdas.
Rely on the frontend weeding out cases that are not supported.

In psi2ir, introduce all the parameters before processing default
values.

Change the DefaultArgumentStubGenerator to generate code that
matches the behavior of the current backend.
2019-10-10 09:00:51 +02:00
Mikhail Glukhikh 813e35643c FIR resolve: fix constructor handling in qualifier scope
Constructors aren't more visited twice in regular scopes
2019-10-04 18:59:10 +03:00
Mikhail Glukhikh 4718ae4186 FIR: don't perform argument check for callable references
This fixes failing FIR2IR test
2019-09-27 09:23:34 +03:00
Mikhail Glukhikh da7d5d5702 FIR: provide receiver for accessor of extension property 2019-09-27 09:22:52 +03:00
Steven Schäfer 76ab631214 psi2ir: Optimize generated data class members
- Access underlying fields directly, instead of using accessors. This is
  safe since data classes are always final.
- Don't generate a temporary variable in hashCode to use as the
  accumulator.

Both optimizations are effectively present in the current JVM backend
and with these changes the generated code is much closer to what the
current backend generates.
2019-09-18 18:56:42 +02:00
Denis Zharkov 2bdbed978b FIR: Support SAM constructors 2019-09-18 10:03:55 +07:00
Denis Zharkov 5567620563 FIR: Support SAM conversion 2019-09-18 10:00:04 +07:00
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