Commit Graph

41324 Commits

Author SHA1 Message Date
Ilya Kirillov 4b7cacd55e [FIR] do not ignore nested type aliases in FirNestedClassifierScope 2022-11-11 12:00:01 +01:00
Ilya Kirillov 7059f7fbe7 [fir] mark functional type contexts receivers as not traversed in RawFirBuilderTotalKotlinTestCase 2022-11-11 12:00:01 +01:00
Ilya Kirillov 068168bc3c [fir] change setter parameter name to value 2022-11-11 11:59:56 +01:00
Ilya Kirillov ed1751bbc6 [fir] move mutable/base collection pair map do StandardClassIds to further reuse it 2022-11-11 11:59:56 +01:00
Ilya Kirillov 725ae1fc65 [Analysis API] separate non-class error types from class error types and add information about type qualifiers
it's needed for type printing in renderer
2022-11-11 11:59:55 +01:00
pyos a968193349 K2: fix logic for supertypes annotation deserialization 2022-11-10 22:12:34 +00:00
pyos e7b4927b6c FIR: don't emit SENSELESS_NULL_IN_WHEN when value is always null
This case (value is always null) contradicts the error message which says
"Expression under 'when' is never equal to null".
2022-11-10 13:10:58 +00:00
pyos fbb54f0300 FIR: fix Clonable detection condition in inline checker 2022-11-10 11:34:53 +01:00
Hung Nguyen cdbbead157 Handle changes to inline functions/property accessors with @JvmNames
If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Extract KotlinClassInfo to a separate class

to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Update unit tests for handling `@JvmName`s

In a previous commit, we made a behavior change for inline property
accessors: The existing behavior is that if the implementation of an
inline getter has changed, only usages of the getter will be impacted
but not usages of the setter (and vice versa).

After that previous commit, usages of *both* the getter and setter will
now be impacted (i.e., we might compile slightly more files). This is
because a change to either the getter or the setter will now be
considered a change to the property, which will help simplify our change
analysis.

This commit updates the relevant unit tests to reflect the new behavior.

Test: Updated Incremental*TestGenerated.PureKotlin#testInlinePropertyInClass
      and Incremental*TestGenerated.PureKotlin#testInlinePropertyOnTopLevel

^KT-54144 Fixed
2022-11-10 10:03:55 +01:00
Dmitrii Gridin 1dfca7aca9 [FIR2IR] add option to allow IdSignature for members of local classes
^KT-54311
2022-11-10 06:39:19 +00:00
Mads Ager 636024f676 [JVM] Retain deprecated status for interface companion const property.
Create the field directly and maintain the fact that its corresponding
property is the companion object property. That property has the
deprecated annotation which puts the deprecated marker on the field
when code generating the field.

^KT-54840 Fixed
2022-11-09 23:15:31 +01:00
Xin Wang 7b3ce35613 JVM_IR: Prevent writing output after an error is reported
#KT-53825 Fixed
2022-11-09 23:14:11 +01:00
Pavel Mikhailovskii 252e97663b KT-54784 Fix function inlining in init sections 2022-11-09 17:15:37 +00:00
Zalim Bashorov d29010807a [Wasm] Apply recent changes in TFR proposal and update v8
Type index immediate was added to call_ref and return_call_ref instructions.
More details here https://github.com/WebAssembly/function-references/pull/76
2022-11-09 13:44:38 +01:00
Sergej Jaskiewicz 7b7c517dbb [JS IR] Emit original names for local vars to sourcemaps
#KT-35655 Fixed
2022-11-09 12:35:44 +00:00
Simon Ogorodnik 4f6ebdc97f Tests. Fix JavaSourceInnerClassInClassPathTest writing to project root 2022-11-08 17:33:05 +00:00
Alexander Korepanov d5a73a5df1 [JS IR] Return JsIrProgramFragment generators instead of ready objects
It allows to free IrFile objects on flight
right after the JsIrProgramFragment producing.
2022-11-08 15:18:45 +00:00
Alexander Korepanov 4aaae5347a [JS IR] Allow IC metadata to be freed before the lowering 2022-11-08 15:18:45 +00:00
Alexander Korepanov 5b70d39bd0 [JS IR] Move id signature functions into a separate file 2022-11-08 15:18:44 +00:00
Alexander Korepanov c0a1fa6f98 [JS IR] Move the JS AST serialization right before the IC data committing
It allows not to keep the binary representation in memory
2022-11-08 15:18:44 +00:00
Alexander Korepanov eb781168b8 [JS IR] Move an IC IR loading process into a separate function 2022-11-08 15:18:44 +00:00
Alexander Korepanov 95e305be3a [JS IR] Simple memory optimizations
- Use hash maps and hash sets instead of linked implementations
 - Use weak hash maps for caches with IR elements as keys
 - Intern JS function signatures
2022-11-08 15:18:43 +00:00
Alexander Korepanov 731dd9c3e8 [JS IR] More detailed time measurement for the IC infrastructure 2022-11-08 15:18:43 +00:00
Anna Kozlova 79bed083e6 [FIR] allow primary constructors in interfaces to support invalid code
KTIJ-23504
2022-11-08 14:51:33 +01:00
Alexander Korepanov 92638573ce [JS IR] Add messages about unused cli arguments 2022-11-07 17:57:42 +00:00
Alexander Korepanov cb7df4d428 [JS IR] IrModuleToJsTransformerTmp.kt -> IrModuleToJsTransformer.kt 2022-11-07 17:57:41 +00:00
Alexander Korepanov 041e755c70 [JS IR] Cleanup BackendContext flags 2022-11-07 17:57:41 +00:00
Alexander Korepanov 4d37c1d49c [JS IR] Drop generateScriptModule flag from Merger class 2022-11-07 17:57:41 +00:00
Alexander Korepanov f1bce9fad4 [JS IR] Drop StableNamesCollector.kt 2022-11-07 17:57:40 +00:00
Alexander Korepanov 99e93258cd [JS IR] Drop NameTables class 2022-11-07 17:57:40 +00:00
Alexander Korepanov 43fbb0ba3e [JS IR] Drop IrNamerImpl.kt 2022-11-07 17:57:39 +00:00
Alexander Korepanov 7b8bd47b1a [JS IR] Drop MultiModuleSupport.kt 2022-11-07 17:57:39 +00:00
Alexander Korepanov 05395f716c [JS IR] Drop old IrModuleToJsTransformer 2022-11-07 17:57:39 +00:00
Alexander Korepanov d17794481d [JS IR] Replace IrModuleToJsTransformer with IrModuleToJsTransformerTmp 2022-11-07 17:57:38 +00:00
Vladimir Dolzhenko 2ec07b861b Add languageSetting provider
Access to facets could be heavy

#KTIJ-23501
2022-11-07 17:20:21 +00:00
Alexander Udalov d7a58a7c6c Keep track of array types in OptimizationBasicInterpreter
Merging array types with different element types, for example
`[Lj/l/String;` and `[Lj/l/Object;`, now produces `[Lj/l/Object;`
(instead of `Lj/l/Object;`), which allows for more precise tracking of
null values because we assume that AALOAD on a non-array typed value is
possible only if that value is null.

 #KT-54802 Fixed
2022-11-07 17:22:38 +01:00
Bogdan Mukvich 080b034950 Move code conformance tests from compiler tests
#KTI-962
2022-11-07 15:01:31 +00:00
nataliya.valtman 9b212cfa86 Revert "Extract KotlinClassInfo to a separate class"
This reverts commit ec3da62672.
2022-11-07 13:59:32 +01:00
Hung Nguyen ec3da62672 Extract KotlinClassInfo to a separate class
to reduce the size of IncrementalJvmCache and prepare for the next
change.

^KT-54144 In progress

Handle changes to inline functions/property accessors with `@JvmName`s

If we detect a change in an inline function `foo` with @JvmName
`fooJvmName`, we have two options:
   1. Report that function `foo` has changed
   2. Report that method `fooJvmName` has changed

Similarly, if we detect a change in an inline property accessor with
JvmName `getFoo` of property `foo`, we have two options:
   1. Report that property `foo` has changed
   2. Report that property accessor `getFoo` has changed

The compiler is guaranteed to generate `LookupSymbol`s corresponding to
option 1 when referencing inline functions/property accessors, but it is
not guaranteed to generate `LookupSymbol`s corresponding to option 2.
(Currently the compiler seems to support option 2 for *inline*
functions/property accessors, but that may change.)

Therefore, we will choose option 1 as it is cleaner and safer.

^KT-54144 In progress

Ignore inline functions that are not found in the bytecode

^KT-54144 In progress

Add unit test for handling `@JvmName`s

Test: KotlinOnlyClasspathChangesComputerTest
             #testFunctionsAndPropertyAccessorsWithJvmNames
^KT-54144 Fixed

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress

Small cleanup in IncrementalCompilerRunner

 - Add comment for closing caches
 - Rename providedChangedFiles to changedFiles
 - Tiny clean up in `performWorkBeforeCompilation`
 - Count directories to delete in debug logs

^KT-53015 In progress
2022-11-07 13:10:02 +01:00
Bogdan Mukvich fce8b877c8 Remove unused WriteCopyrightToFile gradle task
#KTI-758
2022-11-07 08:24:19 +00:00
Alexander Korepanov d5e9e87538 [JS BE] Drop JS scripting support
JS scripting uses the old IR to JS transformer.
 The new IR to JS transformer can not be used for
 JS scripting out of the box. Patching the new transformer for
 JS scripting is potentially dangerous and requires a lot of effort.
 Dropping JS scripting and the old IR to JS transformer allows to
 refactor and simplify JS BE codebase.
2022-11-04 14:15:15 +00:00
Vladimir Dolzhenko 5dc2442872 Safe reporting PSI elements in KEWA 2022-11-03 17:27:11 +00:00
pyos 20871dd555 FIR DFA: update assignment indices when joining flows 2022-11-03 13:33:11 +00:00
pyos 8e40566520 Minor: make a function that intersects N maps shorter 2022-11-03 13:33:10 +00:00
pyos 639a454d6c FIR DFA: when joining flows, clear reassigned vars with no statements
For example:

    val c = C("...")
    val x = c.x // alias to variable for c.x, which depends on c
    if (x == null) return
    // now c.x has type Any
    c = C(null)
    // c has been reassigned => info for c.x is no longer valid;
    // c itself has never had any statements made about it, but
    // we must still call removeAllAboutVariable to clear the
    // dependents
2022-11-03 13:33:10 +00:00
pyos 0781cd12d4 FIR DFA: copy logic statements to aliases before removing variables
^KT-54744 Fixed
2022-11-03 13:33:09 +00:00
pyos 31eaa211b7 Add test for KT-54744 2022-11-03 13:33:09 +00:00
Nikita Bobko a926edd845 Disable ReferencesToSyntheticJavaProperties until the KEEP document is approved
KEEP document: https://github.com/Kotlin/KEEP/pull/329
2022-11-03 12:02:59 +00:00
Dmitriy Novozhilov 2fd8bf9153 [FIR] Don't analyze lambda twice inside delegate inference
This is a workaround for ^KT-54767
2022-11-03 08:30:09 +00:00
Dmitriy Novozhilov 7af43176ce [FIR] Add optin on API of updating type of receiver values. KT-54708 2022-11-03 08:30:09 +00:00