Commit Graph

2126 Commits

Author SHA1 Message Date
Alexander Udalov b6fdc96994 Reverse dependency 'psi' <-> 'frontend.common'
Move ParseUtils to 'psi', and ImportPath to 'frontend.common'.

Now 'psi' depends on 'frontend.common', and that allows to remove
dependency of 'fir:tree:tree-generator' on 'psi', allowing the former to
compile in parallel with the old frontend code.
2020-03-28 21:30:07 +01:00
Igor Chevdar 90abf1fda0 [JS_IR] Don't capture the bound receiver of a CR 2020-03-28 15:26:19 +03:00
Dmitry Petrov 042424d599 KT-27524 Don't box (some) inline classes in suspend fun return
If an inline class is mapped to a reference type (or an array), it's Ok
to treat JVM view on a suspend function as returning a value of
corresponding inline class (although in reality it returns 'Any?'
because of COROUTINE_SUSPENDED).
2020-03-27 18:29:36 +03:00
Mikhail Glukhikh d8bc29e6c6 [FIR] Eliminate obsolete NO_SUPERTYPE diagnostic from builder 2020-03-27 18:24:50 +03:00
Nick b38d30bab0 [FIR] Support several super-related diagnostics 2020-03-27 18:24:50 +03:00
Steven Schäfer 58685be4e2 IR: Don't use IrStringConcatenation for ordinary toString calls
We can only use IrStrinConcatentation to represent calls to Any?.toString
and toString calls on primitive types. Otherwise, x.toString() and "$x"
are observably different when x is a non-null type with null value
(e.g., an @NotNull value coming from Java).
2020-03-27 17:31:48 +03:00
Mikhail Glukhikh 7bfd354a77 Don't report UNUSED_PARAMETER in main from object #KT-37718 Fixed 2020-03-27 16:46:59 +03:00
Mikhail Glukhikh cec0f58544 [FIR] Introduce & use toFirLightSourceElement 2020-03-27 16:46:59 +03:00
Mikhail Glukhikh 6a5acc024a [FIR] Rename PSI version of toFirSourceElement 2020-03-27 16:46:59 +03:00
Mikhail Glukhikh b27152f903 Replace some FIR syntax errors with more proper diagnostics 2020-03-27 16:46:59 +03:00
Mikhail Glukhikh 2f63c8a46a [FIR] Enhance diagnostic DSL to be able to use concrete factories
Before this commit, things like DiagnosticFactory0<KtDeclaration>
were effectively unusable.
2020-03-27 16:46:58 +03:00
FenstonSingel b7d8e879a6 [FIR] Support 4 diagnostics for pairs of modifiers
In particular, this commit includes:
* Attempt to abstract access to FirSourceElement via FirModifier
* Add more visit functions to DeclarationCheckersDiagnosticComponent
* Add messages+factories for 4 modifier-related errors and warnings
* Introduce FirModifierChecker
2020-03-27 12:34:29 +03:00
Roman Artemev 6e01ec8dd3 [IR] Fix translation of synthetic generic java properties
- Compute substituted accessor descriptor to avoid unbound type parameters
2020-03-27 10:52:33 +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
Dmitriy Novozhilov 3acb64c536 [FIR] Add flexible default upper bound for java type parameters 2020-03-27 10:17:12 +03:00
Pavel Kirpichenkov e39b69839b [NI] Make constraint check for type variables with complex dependency
Additional check for trivial constraints is needed to make lambda
analysis before outer variable fixation to Nothing(?)

^KT-37627 Fixed
2020-03-26 17:06:37 +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 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
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
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 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
Jinseong Jeon acbe3126b1 FIR: consider all functions in scope when computing dispatch receiver parameter. 2020-03-25 09:20:07 +03:00