Commit Graph

102 Commits

Author SHA1 Message Date
Mikhail Glukhikh 6f0eeecc64 [FIR2IR] Fix generation of type arguments of delegated constructor calls 2020-06-09 11:40:26 +03:00
Mikhail Glukhikh 457fb09e3a [FIR] Use tower to resolve delegated constructors, set dispatch receiver 2020-05-12 16:57:07 +03:00
Jinseong Jeon 9a561f4a7c FIR2IR: generate synthetic members for inline class 2020-04-30 13:09:53 +03:00
Mikhail Glukhikh fe02c2bab3 FIR: return Unit from empty lambda 2020-04-20 17:05:34 +03:00
Jinseong Jeon 9f1ecadd65 IR: more consolidation of synthetic member generation for data class. 2020-04-17 12:38:38 +03:00
Jinseong Jeon 08b91da6db FIR: fix body generation for data class's copy method 2020-04-14 11:51:30 +03:00
simon.ogorodnik 356e42196c [FIR2IR] Fix inner class constructor receiver parameter type 2020-04-13 20:26:19 +03:00
simon.ogorodnik 132c8ee210 [FIR] Apply GOOD testData changes after type parameters support 2020-04-13 20:26:18 +03:00
Jinseong Jeon c370b86141 IR: consolidate generation of synthetic members for data class 2020-04-13 17:30:05 +03:00
Mikhail Glukhikh 00fedbf6b3 [FIR2IR] Distinguish 'parent' & 'thisReceiver' for fake overrides 2020-04-09 15:22:56 +03:00
Jinseong Jeon cdf5a2a5a1 FIR: set dispatch receiver parameter for inner class's constructor. 2020-03-25 12:40:09 +03:00
Mikhail Glukhikh 95108a1bce [FIR2IR] Enable type parameter index >= 0 requirement 2020-03-18 17:09:36 +03:00
Mikhail Glukhikh 10c2aa1657 [FIR2IR] Set origin properly for set field / variable 2020-03-18 17:09:35 +03:00
Mikhail Glukhikh 3d17ce05b5 [FIR] Introduce FirResolvedArgumentList with argument-parameter mapping
#KT-36345 Fixed
2020-03-11 22:08:59 +03:00
Mikhail Glukhikh e9699e7173 FIR2IR: provide correct origins for arithmetic operators 2020-03-10 15:19:35 +03:00
Dmitriy Novozhilov 770dfb69ba [FIR] Analyze all statements in block except last one in independent mode
Some broken tests will be fixed in next commit
#KT-37176 Fixed
2020-03-05 16:48:47 +03:00
Mikhail Glukhikh db7401d8eb FIR2IR: set GET_PROPERTY origin for property reads 2020-02-28 15:29:01 +03:00
Mikhail Glukhikh 3a3d6e740c FIR2IR: correctly set type parameters of property accessors
In particular, we generate different type parameters for
getters & setters here.
2020-02-28 15:29:01 +03:00
simon.ogorodnik f9483b1f4f [FIR] KT-37027: Add 'out' projection to vararg elements 2020-02-27 19:07:17 +03:00
Mikhail Glukhikh d1fac6dce1 FIR2IR: declare receivers for all accessors of extension properties
Before this commit, extension receivers were declared only for
properties with container source, which is strange & inconsistent.
Now we declare accessor extension receiver iff corresponding property
has extension receiver.
2020-02-25 12:13:42 +03:00
Steven Schäfer 50c477bee1 Update IR text test expectations for FIR 2020-02-15 22:38:10 +03:00
Mikhail Glukhikh ba770f7b61 FIR2IR: fix type parameter indexes & fix some black-box & FIR2IR tests 2020-02-12 17:02:41 +03:00
Juan Chen 8e35545e10 FIR2IR: provide type arguments for class 'this' receiver 2020-02-11 22:50:06 +03:00
Juan Chen 7249d2f889 [FIR] Fix translation of invokes & add return expressions for lambdas
* fixed NoSuchMethod caused by mismatched signatures of the "invoke" method generated for lambda arguments
* added test cases in invoke.kt for KFunction and anonymous functions
* added a transformer to wrap the last expression in the bodies of lambdas with return
2020-02-06 12:44:14 +03:00
Juan Chen 188abc243a [FIR] add vararg arguments support, improve vararg parameters support 2020-01-31 16:41:25 +03:00
Mads Ager e327b174a2 IR: Use name \$\$delegate_n for the field for interface delegation.
Without this change, these fields could have names such as
`<no name provided>$SuperClass$delegate` for something like
`object SuperClass by I { }`.
2020-01-27 15:28:27 +03:00
Juan Chen 573188bdc4 [FIR2IR]: fix translation of this references in instance methods
Currently FirThisReceiverExpression of instance methods are translated
to references of the class' thisReceiver,
not the method's dispatch receiver,
which causes problems with IrFrameMap::typeOf,
as the class' thisReceiver is not in the typeMap.

This commit translates non-qualified "this" references of
instance methods to references of the methods' dispatch receiver.
2020-01-10 10:43:07 +03:00
Mikhail Glukhikh 1cf582e9ed FIR2IR: set extension receiver for anonymous functions 2019-12-27 15:31:36 +03:00
Denis Zharkov b8984d154b FIR: Do not copy type parameters from class to constructors
Use the same instances from class declaration instead

Otherwise, primary constructor value parameter types when used
in the class body are considered as different from types
based on the class type parameters

See the test genericConstructors.kt, before this commit
"id" call was reported in inapplicable
2019-12-05 13:08:51 +03:00
Dmitry Petrov cb1b9c2ccf IR testData: IrSimpleFunction.isOperator 2019-11-29 13:53:05 +03:00
Denis Zharkov f68929fe74 FIR: Leave functions type parameters in subsituting scope 2019-11-27 11:20:52 +03:00
Mark Punzalan 5afab1ac2b [FIR] FIR2IR: Populate calls with type arguments and function type
parameters with bounds/supertypes.
2019-11-25 09:37:47 +03:00
Dmitriy Novozhilov 010dae454e [FIR] Fix extracting parameters from extension function types 2019-11-05 15:22:23 +03:00
Steven Schäfer 733c7579aa Normalize names of temporary variables in IrTextTests 2019-11-05 14:58:47 +03:00
Dmitry Petrov 82c527c2cc IR: IrProperty.isFakeOverride 2019-11-01 14:55:10 +03:00
Dmitry Petrov 2682057767 IR tests: update testData for IrSimpleFunction.isFakeOverride 2019-11-01 14:55:09 +03:00
Dmitry Petrov 843fb88459 IR: IrSimpleFunction.isFakeOverride 2019-11-01 14:55:09 +03:00
Steven Schäfer af74fd047a psi2ir: Consistently use type unit for statements
These changes allow us to accurately distinguish between statements and
expressions in the IR.

This also fixes the types of non-exhaustive conditional statements.
2019-10-31 11:13:44 +03:00
Dmitriy Novozhilov 36ad065792 [FIR] Fix testdata broken after d2b895d8 2019-10-30 18:49:07 +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
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
Mikhail Glukhikh 5386cfe254 FIR2IR: support fake overridden properties 2019-09-05 16:26:14 +03:00
Mikhail Glukhikh bd5e1aeef5 FIR2IR: change backing field visibility to private 2019-08-30 11:47:32 +03:00
Mikhail Glukhikh 13d14df8ae FIR: set dispatch receiver for data class generated functions 2019-08-30 11:47:31 +03:00
Steven Schäfer a90ac2438d Set correct field visibility in psi2ir 2019-08-28 19:41:11 +02: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
Dmitry Petrov bdec8b04e8 Minor: trim in RenderIrElementVisitor 2019-07-31 10:37:35 +03:00
Mikhail Glukhikh 63b7fa70f9 FIR2IR: add extension receiver parameters to functions 2019-07-25 09:46:29 +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