Commit Graph

72781 Commits

Author SHA1 Message Date
Georgy Bronnikov 4e9bedc2fc JVM_IR: use ConcurrentHashMap
Replace mutable maps and sets accessed from by-file lowerings with
ConcurrentHashMap, so that lowerings can operate on them in parallel.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov 23da2bde67 IR: fixes for IR by-file copying 2021-02-17 11:03:27 +03:00
Georgy Bronnikov 54a76977db IR: fix fake override computation
Due to IR copying in performByIrFile, we need to only distinguish
overrides up to their fqName.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov d154c8d8e6 IR: copy each file before lowering.
Avoid inter-file dependencies while lowering.
2021-02-17 11:03:27 +03:00
Georgy Bronnikov 103f82c95c IR: an option to automatically select the number of lowering threads 2021-02-17 11:03:27 +03:00
Georgy Bronnikov 52b3cb362b IR: thread pool in PerformByIrFilePhase 2021-02-17 11:03:27 +03:00
Georgy Bronnikov eae416d739 IR: Handle exceptions from by-file lowering thread 2021-02-17 11:03:27 +03:00
Georgy Bronnikov bea5d955d4 JVM_IR: perform file lowerings in parallel
Selected by -Xir-run-lowerings-in-paralled compiler flag.
2021-02-17 11:03:26 +03:00
Anton Bannykh c06b345f3c Hide stageController into the IrFactory 2021-02-17 10:42:50 +03:00
Anton Bannykh 97080c49fc Persistent IR generator
Goal:
- avoid hand-writing the boilerplate
- easier PIR evolution

Output is reasonably close the hand-writtern version
2021-02-17 10:42:50 +03:00
Anton Bannykh 8a0ce20d43 PIR: minor restructuring 2021-02-17 10:42:50 +03:00
pyos 1310a65f0c JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would
reference their lambdas' captures through the original this$0. On
JVM_IR, using loose capture fields means a name/descriptor clash can
occur on any level of nesting, not just the top.
2021-02-17 07:56:03 +01:00
Nikolay Krasko ec89cb2313 Ignore hanging KotlinAndroid36GradleIT.testAndroidMppSourceSets()
Ignore till the proper investigation.
Probably caused in https://github.com/JetBrains/kotlin/compare/b262d09a81bf20ffd71db18a0c24ac4f61fa151c...5c7aadece929f79a39bf0ad20549e30d5e391a7c.
2021-02-17 00:26:19 +03:00
Ilmir Usmanov ec569a4c89 Minor. Suppress errors in tests 2021-02-16 20:59:25 +01:00
Ilmir Usmanov bad197e075 Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error 2021-02-16 20:59:21 +01:00
Dmitry Petrov 56a104dda9 JVM_IR KT-44974 fix SAM-converted capturing extension lambda 2021-02-16 19:51:59 +03:00
Dmitriy Novozhilov 83ed67546b [Test] Support WITH_STDLIB directive in js box tests 2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov dfcff132fd [FIR] Fix false-positive smartcast on receiver in rhs of elvis
#KT-44942 Fixed
2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov 2b39282682 [FIR] Render original type before smartcasted type in DEBUG_INFO_EXPRESSION_TYPE
This is made for keep consistency with same renderer in FE 1.0
2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov d4c26cca52 [FIR] Use type without smartcast for local variable with smartcasted initializer 2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov 40e286b354 [FIR] Increase level of sequential when branches
Level of CFGNode is used to determine which call is a common one for
  creating node with union of arguments (to merge flow from multiple
  in-place lambdas). Before this change calls in different when branches
  may have same node level, which entail passing smartcasts from moddle of
  one branch to another

```
val x: Any = ...
when {
    ... -> run { x as String } // (1)
    ... -> {
        run {
            x.foo()
        } // (2)
        "hello"
    }
}
```

Call `(1)` was assumed as argument of call `(2)` which is incorrect

#KT-44814 Fixed
2021-02-16 17:51:31 +03:00
Dmitriy Novozhilov 92271527cb [Test] Add CFG and IR dump handlers to FirBlackBoxTests 2021-02-16 17:51:31 +03:00
Dmitriy Novozhilov b5619dbf37 [FIR] Add ability to render node levels in CFG graph dumper 2021-02-16 17:51:31 +03:00
Ilya Kirillov 3e22011626 Fix compilation of HLRedundantVisibilityModifierInspection 2021-02-16 15:47:08 +01:00
Ilya Kirillov e8f3ebdd19 FIR IDE: introduce HLRedundantVisibilityModifierInspection by extended checker 2021-02-16 15:23:18 +01:00
Ilya Kirillov 6d97841f38 FIR IDE: introduce HLLocalInspectionTest 2021-02-16 15:23:18 +01:00
Ilya Kirillov 7fb6c22889 FIR IDE: allow creating inspections by extended checkers 2021-02-16 15:23:17 +01:00
Ilya Kirillov b9a4613e44 FIR IDE: remove getMessage from HLPresentation as it duplicates HLApplicator.getActionName 2021-02-16 15:23:17 +01:00
Ilya Kirillov c13889c2ea FIR: add ability to specify checkers list for checker components 2021-02-16 15:23:17 +01:00
Ilya Kirillov ca4a07f73f Unify message bundles used in IDEA FIR into KotlinBundle 2021-02-16 15:23:17 +01:00
Vladimir Dolzhenko 6352814d45 Fix NPE
#KTIJ-898 Fixed

Original commit: 12d8e88b846f29598ca3904b49996bd6a9891ccd
2021-02-16 14:21:40 +00:00
Vladimir Dolzhenko 98ba379e07 Fixed NPE on StandaloneScriptRootsCache instantiation
Relates to ^EA-218043
#KTIJ-1137 Fixed

Original commit: 1d63a1b48d480b958ff44676c42b698a8ca5f64a
2021-02-16 14:21:39 +00:00
Dmitriy Dolovov 45b17120ad [Commonizer] Minor. Rename: 'dependee' -> 'dependency' 2021-02-16 17:19:49 +03:00
Dmitriy Dolovov ec7e411d80 [Commonizer] Remove classifierId from CIR class/TA nodes 2021-02-16 17:19:43 +03:00
Dmitriy Dolovov ef931d5561 [Commonizer] Don't keep kotlin/Any as the single supertype in CirClass 2021-02-16 17:19:38 +03:00
Victor Petukhov baeee8988e [all-open] Don't affect private declarations to change their modality to open 2021-02-16 17:18:08 +03:00
Victor Petukhov ec41775d7e [all-open] Fix formatting 2021-02-16 17:18:07 +03:00
Mads Ager 05ff2b1292 [JVM_IR] Extend when to switch translation to deal with nested ors.
FIR translates:

```
when (x) {
  1, 2, 3 -> action
  else -> other_action
}
```

to an IR structure with nested ors:

```
if ((x == 1 || x == 2) || (x == 3)) action
else other_action
```

This change allows that to turn into switch instructions in the
JVM backend.
2021-02-16 03:20:07 -08:00
Ilya Kirillov 91581d6c1a Move KotlinBundle to frontend-independent module
to use from IDEA FIR
2021-02-16 12:16:17 +01:00
Mikhail Glukhikh a8c23e1c3a FirDefaultStarImportingScope: filter INVISIBLE_CLASSES properly 2021-02-16 12:38:46 +03:00
Mikhail Glukhikh 940588a9bb FE: commonize throw-related annotation FQ names 2021-02-16 12:38:46 +03:00
pyos 2dc0404751 FIR: prioritize visible imported classes during type resolution
and produce an error on ambiguity.
2021-02-16 12:38:45 +03:00
pyos 291ed4a38a FIR: handle typealiases during conflict resolution 2021-02-16 12:38:45 +03:00
Hung Nguyen 592c285198 Kapt: Don't create KDocCommentKeeper when not needed
Previously, even if `keepKdocComments=false`, we would still create the
KDocCommentKeeper object unnecessarily.

This commit makes sure we create the object only if
`keepKdocComments=true`.

Bug: Clean-up after commit e252171 for KT-43593
Test: Existing tests
2021-02-16 11:53:49 +03:00
Ilya Kirillov 0a72e16451 FIR: transform DiagnosticBuilder DSL to an object
To make diagnostics visible in symbol search in IJ
2021-02-15 22:28:13 +01:00
SokolovaMaria 15aaf3a078 Copy typeParameters from original declaration to the exportedDefaultStubFun before substitution of type parameters 2021-02-15 23:17:11 +03:00
Mark Punzalan 706d3e5aa8 FIR IDE: Add quickfix for VAR_ANNOTATION_PARAMETER. 2021-02-15 21:07:32 +01:00
Mark Punzalan 2f450549ab FIR IDE: Update FIR diagnostic test data for
INAPPLICABLE_LATEINIT_MODIFIER.
2021-02-15 19:37:14 +01:00
Mark Punzalan 4e44804c77 FIR IDE: Add quickfix for INAPPLICABLE_LATEINIT_MODIFIER.
Also changed FE1.0 checker and all related fix factories to report error
on the declaration instead of the lateinit modifier. This is consistent
with the direction of all checkers in FIR (no reporting on modifiers).
2021-02-15 19:37:14 +01:00
Dmitry Petrov b1ab64e854 JVM_IR KT-44483 argument adaptation is already done in PSI2IR 2021-02-15 19:41:39 +03:00