Commit Graph

78 Commits

Author SHA1 Message Date
simon.ogorodnik ac1769a474 [FIR2IR] Support SAM constructors 2020-05-25 21:24:39 +03:00
Jinseong Jeon 615636ed55 FIR2IR: apply SAM conversion to arguments of functional type. 2020-05-15 15:08:43 +03:00
Mikhail Glukhikh cdac6157a9 [FIR2IR] Force loading Java SAM from external classes 2020-05-14 14:07:40 +03:00
Mikhail Glukhikh fe02c2bab3 FIR: return Unit from empty lambda 2020-04-20 17:05:34 +03:00
simon.ogorodnik 276c393141 [FIR] Support captured type parameters in java symbol provider 2020-04-13 20:26:19 +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
Dmitriy Novozhilov 48fb279721 [FIR] Add constraint to flexible type for declared argument for java parameter 2020-03-27 10:17:12 +03:00
Jinseong Jeon cdf5a2a5a1 FIR: set dispatch receiver parameter for inner class's constructor. 2020-03-25 12:40:09 +03:00
Dmitriy Novozhilov ea02855ba6 [FIR] Fix type arguments and substitution for flexible types 2020-03-20 23:11:28 +03:00
Mikhail Glukhikh e9699e7173 FIR2IR: provide correct origins for arithmetic operators 2020-03-10 15:19:35 +03:00
Mikhail Glukhikh 883dd95e3c FIR: fix class / constructor type parameter duplication 2020-02-28 15:29:02 +03:00
Mikhail Glukhikh 522eeae062 FIR2IR: standardize expression with smart cast conversion
To convert smart cast expression, now we just convert
original expression in standard way and wrap it with TYPE_OP.
Before this commit original expression was converted in different way,
that led to errors e.g. for this expression casting.
2020-02-25 12:13:42 +03:00
Mikhail Glukhikh e051251b27 FIR: set isOperator only for Java methods with appropriate names
#KT-35133 Fixed
2020-02-19 18:09:04 +03:00
Dmitry Petrov 0c984c5e62 PSI2IR tests for b29993739e85dbceb02d04a964741b1410a568f8 2020-02-13 23:43:04 +03:00
Mikhail Zarechenskiy 1ba0870ae3 [NI-MIGRATE] Update IR text tests 2020-02-13 11:16:00 +03:00
Denis Zharkov 9c1577092b FIR: Fix SAM conversion for constructor calls 2020-02-12 16:05:11 +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
Mads Ager e8a640851a FIR: Change the Fir2Ir handling of smart casts.
Generate the expression with the original type and then insert
an implicit conversion. That matches the behavior of psi2ir
better and therefore avoids breaking backend assumptions.

In particular, IrGetValue expects the type of the underlying
symbol and the type of the IrGetValue to be the same.
2020-01-31 09:31:52 +01:00
Dmitry Petrov c540116b71 IR: additional callable reference adapter stuff in IR
- IrFunctionReference.reflectionTarget: IrFunctionSymbol?
- add separate declaration origin for callable reference adapters
- bump IR ABI version
2020-01-24 11:21:26 +03:00
Victor Petukhov 437a26684d NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds
^KT-32435 Fixed
2020-01-17 19:16:09 +03:00
simon.ogorodnik ba4163ba02 [FIR] Improve synthetic functional interfaces support
Rename fictitiousFunctionSymbols -> syntheticFunctionalInterfaceSymbols
Support suspend function interfaces
Add supertypes for KFunction / KSuspendFunction
2020-01-10 10:57:36 +03:00
Dmitry Petrov d27593aeda PSI2IR: SAM conversion in method arguments of out-projected Java classes
It uses the same logic as an old back-end
(see SamType#createByValueParameter and genericSamProjectedOut.kt),
split into two parts:

1. When inserting SAM casts, use SamType#createByValueParamerer to get
the target SAM type.

2. When inserting implicit casts, cast SAM conversions as arguments of
methods of out-projected types to the original type of value parameter
instead of 'Nothing'.
2020-01-03 15:32:44 +03:00
simon.ogorodnik 5e426fdc71 [FIR] Optimization & checking fix: remove usage of dispatchReceiverValue 2019-12-27 13:45:59 +03:00
Mikhail Glukhikh 737eaebee6 FIR resolve: fold flexible types whenever possible #KT-31528 Fixed 2019-12-16 12:06:10 +03:00
Victor Petukhov 07269661b4 NI: Allow to resolve to functions with SAM conversion and passing array without spread as vararg (with warning)
^KT-35224 Fixed
2019-12-12 23:46:16 +03:00
Dmitry Petrov 20fb519f1a PSI2IR: Generate IMPLICIT_NOTNULL casts for platform type values 2019-12-06 11:03:06 +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
Denis Zharkov fa7bd3dd2e FIR: Support SAM constructors for type aliases 2019-12-03 15:49:22 +03:00
pyos fa8cb7b6e0 PSI2IR: support NewInference + SamConversionPerArgument
except for SAM conversions of varargs (which aren't implemented in the
non-IR JVM backend either btw)
2019-11-29 15:25:32 +03:00
Dmitry Petrov cb1b9c2ccf IR testData: IrSimpleFunction.isOperator 2019-11-29 13:53:05 +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 d56412e397 [FIR] Analyze lambda arguments in erroneously resolved calls 2019-11-19 10:43:46 +03:00
Mikhail Glukhikh bd1127cfa3 FIR: resolve lambda arguments even if an outer call is unresolved 2019-11-06 13:19:20 +03:00
Dmitriy Novozhilov 010dae454e [FIR] Fix extracting parameters from extension function types 2019-11-05 15:22:23 +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 0da4b06074 psi2ir: Fix return insertion
We should only insert a return statement at the end of a lambda or
function if the final statement is used as an expression (slice
USED_AS_RESULT_OF_LAMBDA and USED_AS_EXPRESSION).
2019-10-31 11:13:44 +03:00
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
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
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 5c29af4b53 [FIR] Tests. Update some outdated FIR testdata 2019-09-02 10:43:10 +03:00
Mikhail Glukhikh bd5e1aeef5 FIR2IR: change backing field visibility to private 2019-08-30 11:47:32 +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