Commit Graph

1843 Commits

Author SHA1 Message Date
Denis Zharkov 6793b27330 FIR: Optimize Java types mapping
- Avoid duplicated computations for arguments
- Do not recreate types if they weren't enhanced
2020-02-19 15:53:34 +03:00
Denis Zharkov 2ad8488e6a FIR: Rewrite Java type mapping
Previoisly, there were two places where mapping had happened:
- toConeKotlinTypeWithNullability
- enhancePossiblyFlexible

The first one was used for supertypes and bounds and the second one
was used for other signature parts

The main idea is to perform type mapping once to a flexible type,
and then use it as it's needed (it's lower bound, or for the further ehnancement)

Also, this commit fixes flexibility for type arguments, see the tests
2020-02-19 15:53:34 +03:00
Victor Petukhov 748a326104 NI: Discard definitely not-null types inside invariant positions during inference process
^KT-36816 Fixed
2020-02-19 15:32:12 +03:00
Dmitriy Novozhilov 635ff59d10 [FIR] Fix compiler error after 2aeb1ea2 2020-02-18 17:46:43 +03:00
Dmitriy Novozhilov 6941cd6d28 [FIR] Add @PrivateForInline to prevent setting to var's from inconvenient places 2020-02-18 16:06:11 +03:00
Dmitriy Novozhilov 2aeb1ea234 [FIR] Move some util methods from resolve.calls to types package 2020-02-18 15:19:34 +03:00
Dmitriy Novozhilov cd3fc5b8ec [FIR] Reorganize packages for resolve module 2020-02-18 15:19:34 +03:00
Dmitriy Novozhilov 41d2f41141 [FIR] Fix incorrect smartcasts from || expressions
#KT-36057 Fixed
2020-02-18 15:19:34 +03:00
Dmitriy Novozhilov 89e377763a [FIR] Change rendering for captured types and stub types 2020-02-18 15:19:33 +03:00
Dmitriy Novozhilov c83244c8b5 [FIR] Fix creating and substituting definitely not null types
#KT-36764 Fixed
2020-02-18 15:19:33 +03:00
Dmitriy Novozhilov bf11f1892d [FIR] Change order of initialization synthetic fun in SAM resolution
It's needed because of `substitutedReturnType` relies on bounds
  of type parameters that should be build before access via symbol
  from lookup tag
2020-02-18 15:19:33 +03:00
Pavel Kirpichenkov 6430209074 [NI] Make error CST when any of included types is error
`ErrorType` is not subtype of `Any`, so any set of types containing an `ErrorType` has no common super constructors.
^KT-36745 Fixed
2020-02-18 14:46:29 +03:00
Dmitry Petrov 6d1da6e6d5 KT-36143 Fix type approximation for type arguments in PSI2IR 2020-02-18 14:39:12 +03:00
Mikhail Glukhikh fdf4f477a6 FIR2IR: fix problems with enum entry / anonymous object visibility 2020-02-18 10:50:03 +03:00
Mikhail Glukhikh 56c819f06e FIR2IR: add two-statements block with iterator + while for 'for' loops
Before this commit we had two statements blocks for 'for' loops:
range variable declaration + iterator variable declaration + while loop.
However, BE requires a bit different loop structure to make lowerings
properly so in this commit iterator declaration & while loop were
extracted to separate block.
2020-02-17 20:35:17 +03:00
Mikhail Glukhikh 2bfce4f127 FIR2IR: provide correct origins for 'for' loops 2020-02-17 20:35:17 +03:00
Mikhail Glukhikh 83e68be2dc FIR2IR: add declarations to all library classes from kotlin.* package
Before this commit, all library classes were just stubs.
This commit helps to solve problems with some functions
indirectly used by BE, like IntProgression.first.
2020-02-17 20:35:17 +03:00
Mikhail Glukhikh 4a4fb5a590 Raw FIR: eliminate range variable declaration in 'for' loops 2020-02-17 20:35:17 +03:00
Victor Petukhov 51edf2b351 NI: introduce warning about implicitly inferred Nothing with existing non-Nothing expected type
^KT-35406 Fixed
2020-02-17 19:43:05 +03:00
Dmitriy Novozhilov 811ed1ade4 [FIR] Don't update expression in receiver value with smartcast in candidate factory 2020-02-17 14:45:44 +03:00
Dmitriy Novozhilov e302e06c73 [FIR-TEST] Add test with nullability annotation problem
#KT-36770
2020-02-17 14:45:44 +03:00
Dmitriy Novozhilov 47d5bbc224 [FIR-TEST] Move fixed tests out problems directory 2020-02-17 14:45:44 +03:00
Dmitriy Novozhilov e67c8a55bf [FIR-TEST] Add test with callable reference to member of local class
#KT-36758
2020-02-17 14:45:44 +03:00
Dmitriy Novozhilov d10e56c358 [FIR] Add mapping of primitive types to JVM signatures 2020-02-17 14:45:43 +03:00
Pavel Kirpichenkov 4a7b4d655c [NI] Fix completion for ILT when Nothing constraint is present
Full completion should not be done if lower `Nothing`
is the only proper constraint when constraint with ILT type is present.
ILT will be selected as a resulting type and transformed into `Int`
without attention to possible restrictions from outer calls.
2020-02-17 12:02:51 +03:00
Mikhail Zarechenskiy 724bb1b134 [NI] Force variable substitution for properties with stub types 2020-02-17 10:29:46 +03:00
Kristoffer Andersen 4f36e2ccfc [FIR] Fix FIR2IR Types on SetVariable Expressions 2020-02-15 22:32:23 +03:00
Dmitry Petrov 1e7f8ea037 PSI2IR test for coercion to unit in lambda 2020-02-15 22:32:23 +03:00
Roman Artemev e57d34dd9e Make fix test:
- [JS IR] Unmute fixed tests
 - [IrText] Update testdata
 - [WASM] Temporary turn wasm test off
 - [FirText] Temporary turn fit text tests off
 - [JVM IR] Turn off klib jvm test
 - [IR] Add new test
2020-02-14 18:22:17 +03:00
Roman Artemev 6a37955a36 [KLIB] Implement new linker based on IdSignature
- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
2020-02-14 18:22:16 +03:00
Roman Artemev 31d73c5d79 [Psi2Ir] Move to new linkage scheme based on IdSignature
Now SymbolTable operates with two types of symbols (public and private)
In case of Public symbol IdSignature is used as table key
Private one uses descriptor as the key in similar scheme as before
2020-02-14 18:22:16 +03:00
Pavel Kirpichenkov b161839092 [NI] Report unsafe implicit invoke accordingly to OI
This reverts commit df046683cc.
KT-30695
2020-02-14 18:06:34 +03:00
Dmitriy Novozhilov 1a2d28d25b [FIR-TEST] Add test with callable reference on function with default argument 2020-02-14 17:53:29 +03:00
Dmitriy Novozhilov 3790f31d80 [FIR] Support FirVarargArgumentsExpression in html dump 2020-02-14 17:53:29 +03:00
Dmitriy Novozhilov e696d1d06a [FIR] Improve mapping arguments to parameters 2020-02-14 17:53:28 +03:00
Mikhail Glukhikh 2a55560f3b [FIR TEST] Add test on qualifier resolve priority (corner case) 2020-02-14 17:38:37 +03:00
Mikhail Glukhikh abfe566255 [FIR] Add object support as implicit invoke receiver 2020-02-14 17:38:31 +03:00
Mikhail Glukhikh a8a696c7e1 [FIR TEST] Extend test on invoke priorities 2020-02-14 17:38:25 +03:00
Dmitriy Novozhilov 389dcff125 [FIR] Discard argument with spread in place of non-vararg parameter 2020-02-14 09:18:54 +03:00
Dmitriy Novozhilov 50ac8eb95b [FIR] Add smartcast info to argument of invoke of function with receiver 2020-02-14 09:18:54 +03:00
Dmitriy Novozhilov 4fbed9b363 [FIR] Add builder for FirExpressionWithSmartcast 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov 1da036ac98 [FIR-TEST] Split outdated dfa test to separate tests 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov 1dd7417746 [FIR] Fix configuring label name for lambdas in light tree builder 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov 6b378cab29 [FIR] Don't render lambda bodies in arguments of calls in cfg dump 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov 28c95b1108 [FIR] Don't use psi for rendering control flow graph 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov a4b53b4a20 [FIR] Fix passing flow from contracts with form returns(false) ... 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov 643a4b9c3b [FIR] Support makeDefinitelyNotNull for intersection types 2020-02-14 09:18:53 +03:00
Dmitriy Novozhilov b71e4ebb3f [FIR-TEST] Add !DUMP_CFG directive. Get rid of cfg diagnostic tests 2020-02-14 09:18:52 +03:00
Dmitriy Novozhilov f495c4e215 [FIR-TEST] Move stdlib resolve tests out from resolve directory 2020-02-14 09:18:52 +03:00
Dmitriy Novozhilov 90021f3ece [FIR-TEST] Reorganize tests for data flow analysis 2020-02-14 09:18:52 +03:00