Commit Graph

28874 Commits

Author SHA1 Message Date
Mark Punzalan 4234fa79c0 [JVM IR] Use append(Char) for 1-length string literals in string
templates and plus concatenations.

This is slightly more efficient and mirrors the behavior of the non-IR
backend for templates (but not for plus concatenations).

#KT-36638 Fixed
2020-03-26 12:39:39 +03:00
Dmitry Petrov 9a95941ef3 JVM_IR: Rewrite '?.' and '?:' chains
This shortens code and avoids unnecessary boxing in some cases.
2020-03-26 12:19:25 +03:00
Mikhail Glukhikh 547bb64b18 Fix BB test auto-generation (ignore backend FIR) 2020-03-26 10:31:14 +03:00
Juan Chen aba7706dec [FIR] fix test module set up (this fixes 193 BB tests)
Added creation and initialization of the test module and its dependencies.
When looking at the emptyProgression test,
I found that getProgressionLastElement was not found,
which should be resolved from the dependencies.
2020-03-26 10:30:47 +03:00
Nikolay Krasko 034af78b0f Fix mass build-failure because of bad dependencies in :compiler:visualizer module
Rename raw-fir:common to raw-fir:common -> raw-fir:fir-common.

If there's dependency both on :compiler:visualizer:common and
:compiler:fir:raw-fir:common, only one of artifact is left in classpath
2020-03-26 01:21:37 +03:00
Dmitriy Novozhilov f18cef0a12 [FIR] Update ignore rules of generated backed tests for primitive 2020-03-25 18:07:28 +03:00
Dmitriy Novozhilov 75e2596b34 [FIR] Update imports in generated tree 2020-03-25 18:07:27 +03:00
Dmitriy Novozhilov 6c9dd8bb22 [FIR] Reorganize modules of raw fir builders 2020-03-25 18:07:27 +03:00
Dmitriy Novozhilov 0d6bb33f49 Update version of kotlinx-collections-immutable in dependencies 2020-03-25 18:07:27 +03:00
Leonid Startsev 2bda31ac38 Exclude annotation properties in 'explicit visibility' api mode check
#KT-37432 fixed
2020-03-25 19:41:52 +05:00
pyos be37e7135a Add a test for SMAPs with interleaved files 2020-03-25 14:03:32 +01:00
pyos a3fe9034e2 JVM: refactor some SMAP-related classes
In particular, remove redundant copying from SMAPAndMethodNode (which
also fails for empty methods).
2020-03-25 14:03:32 +01:00
Denis Zharkov 5539ad8ce8 FIR: Fix data-flow for jumps between members of local classes
First of all, note that currently ControlFlowGraphBuilder instance is fully mutable
and shared between all local classes and top-level classes in the same thread

Before this change, previous node for member of local class
was defined as lastNode

And in the case of implicit types, lastNode might be in a middle of another
local class member that is being resolved right now.

See the test:
- "a.length" expression in `bar` should be resolved because smart cast happens
before the class declaration
- "b.length" expression in `bar` should be unresolved because smart cast happens
in a different function

The latter case has been working incorrectly, the call was errorenously
resolved because "lastNode" were pointed just before "bar()" call in "foo"
2020-03-25 15:36:19 +03:00
Denis Zharkov 5584b206c0 FIR: Store local class into scope before analyzing it 2020-03-25 15:36:18 +03:00
Denis Zharkov d869ae7826 FIR: Make resolution logic for local classes the same as for top-level
Run different phases through common transformers sequentially
It should make code more reusable and may help with avoid common bugs
2020-03-25 15:36:17 +03:00
Denis Zharkov 8ea888a111 FIR: Fix getNestedClassifierScope for local classes 2020-03-25 14:54:45 +03:00
Denis Zharkov 7f1049736d FIR: Get rid of FirStatusResolveTransformer.Companion 2020-03-25 14:54:45 +03:00
Denis Zharkov ce939903bb FIR: Prepare status resolution to local/anonymous classes 2020-03-25 14:54:45 +03:00
Denis Zharkov 6894962e3a FIR: Prepare type resolution phase for running on local classes 2020-03-25 14:54:45 +03:00
Denis Zharkov b8fb83e34c FIR: Prepare supertypes computation to anonymous objects 2020-03-25 14:54:45 +03:00
Denis Zharkov 30c8a529a2 FIR: Create FirClass.runAllPhasesForLocalClass extension 2020-03-25 14:54:45 +03:00
Denis Zharkov 41f4c1a003 FIR: Extract LocalClassesNavigationInfo computation 2020-03-25 14:53:34 +03:00
Denis Zharkov 0ca45deeef FIR: Fork flow for anonymous initializer 2020-03-25 14:53:34 +03:00
Denis Zharkov f119839891 FIR: Introduce DataFlowAnalyzerContext 2020-03-25 14:53:34 +03:00
Denis Zharkov dd628bc64a FIR: Make val private in VariableStorage and optimize imports 2020-03-25 14:53:34 +03:00
Denis Zharkov cdd7e41891 FIR: Support proper implicit return type computation for local classes 2020-03-25 14:53:34 +03:00
Denis Zharkov 94193c91a0 FIR: Refactor designated body transformers
The idea is making their mechanics more transparent and clear
Namely, we should move to the next level of designation only for declaration's content

Otherwise there might be some wrong steps when somebody just randomly
calls "transformElement" on the parent declaration.
For example, it happens for local classes when we resolve their supertypes, etc.
2020-03-25 14:49:28 +03:00
Denis Zharkov 1b974f9d65 FIR: Reformat FirDeclarationsResolveTransformer 2020-03-25 14:49:28 +03:00
Denis Zharkov 5c943fe581 FIR: Minor. Reformat file 2020-03-25 14:49:28 +03:00
Denis Zharkov d21437e29d FIR: Prepare body transformers for local classes resolution
- Add outerBodyResolveContext
- Rename FirImplicitBodyResolveTransformer and generalize because it will be used for full body
resolution on local classes
2020-03-25 14:48:53 +03:00
Denis Zharkov 7927ef9f66 FIR: Extract BodyResolveContext from BodyResolveTransformerComponents
Its content is assumed to be changing and might be injected into
body resolver
2020-03-25 14:48:53 +03:00
Denis Zharkov 28f33822ab FIR: Drop unused FirApplyInferredDeclarationTypesTransformer 2020-03-25 14:48:53 +03:00
Denis Zharkov eb154dce1e FIR: Refactor scopes structure in body resolution
- Split top-level scopes into file imports and type parameters
- Make type parameters to be a persistent list
2020-03-25 14:46:05 +03:00
Jinseong Jeon cdf5a2a5a1 FIR: set dispatch receiver parameter for inner class's constructor. 2020-03-25 12:40:09 +03:00
pyos 4558d48481 JVM: add a language feature to omit *E between SMAP strata
Fixes #KT-37704
2020-03-25 10:33:59 +01:00
Dmitriy Novozhilov ae522a0375 [FIR] Use source elements instead of psi in ConversionUtils.kt 2020-03-25 11:35:44 +03:00
Dmitriy Novozhilov 318d029fb2 [FIR] Add light source elements to delegated constructor calls 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov badd156def [FIR] Fix some source elements in light tree fir builder 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov 84ed3f5cf2 [FIR-TEST] Add validation of diagnostics for light tree tests 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov 86e7faf639 [FIR] Add start offset and end offset to FirSourceElement 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov 2c37627b15 [FIR] Add unified diagnostics for psi and light tree 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov 1a3fef5fa1 [FIR] Switch names of FirDiagnostic and ConeDiagnostic 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov e6102599ce [FIR] Rename DefaultErrorMessagesFir 2020-03-25 11:35:43 +03:00
Dmitriy Novozhilov caafe84611 [FIR-TEST] Get rid of FirDiagnosticsTestLightTreeHelper 2020-03-25 11:35:42 +03:00
Jinseong Jeon acbe3126b1 FIR: consider all functions in scope when computing dispatch receiver parameter. 2020-03-25 09:20:07 +03:00
Jinseong Jeon de0c9a5c73 FIR: use dispatch receiver of the enclosing function if any. 2020-03-25 08:27:21 +03:00
Dmitry Petrov d3be0462b6 Fix callable reference to inline class constructor generation 2020-03-24 22:25:59 +03:00
simon.ogorodnik 59393e06f0 [FIR-test] Mute tests with bad test-data 2020-03-24 18:58:19 +03:00
simon.ogorodnik f83c20065d [FIR-test] Unmute passing tests, mostly fir2ir 2020-03-24 18:58:19 +03:00
simon.ogorodnik 27136ef8be [FIR] Support unsigned integer literals 2020-03-24 18:58:18 +03:00