Commit Graph

65204 Commits

Author SHA1 Message Date
Konstantin Tskhovrebov beb59b3075 Refactor: add Project.getMetadataCompilationForSourceSet extension. 2020-05-15 18:27:13 +03:00
Denis Zharkov 5bbb459993 FIR: Refactor FirTowerResolverSession.enumerateTowerLevels
- Leave only onScope callback as onLocalScope/onNonLocalScope are the same in most cases
- Pass towerGroup to callbacks as they are the same all the time
2020-05-15 16:04:44 +03:00
Denis Zharkov 475671563b FIR: Get rid of obsolete local scopes optimizations
They are already filtered out (see FirTowerResolverSession#localScopes initializer)
2020-05-15 16:04:44 +03:00
Denis Zharkov e7a67c7a16 FIR: Extract StandardClassIds.KClass 2020-05-15 16:04:44 +03:00
Denis Zharkov b691b13d8e FIR: Add separate local scopes for blocks 2020-05-15 16:04:44 +03:00
Denis Zharkov b084399b58 FIR: Cleanup local scope tracking 2020-05-15 16:04:44 +03:00
Denis Zharkov e7e84b18cd FIR: Do not retrieve symbol for type construction 2020-05-15 16:04:44 +03:00
Denis Zharkov 25bee057e0 FIR: Do not retrieve file for callable until it's needed 2020-05-15 16:04:44 +03:00
Denis Zharkov 295f7d7500 FIR: Do not add trivial constraints 2020-05-15 16:04:44 +03:00
Denis Zharkov 27aa0040be FIR: Cache supetypes scopes when building callable scopes for qualifier 2020-05-15 16:04:44 +03:00
Denis Zharkov 774c5b55c3 FIR: Avoid creating empty nested classes scopes 2020-05-15 16:04:44 +03:00
Denis Zharkov cd149957ee FIR: Filter out irrelevant local scopes during resolution 2020-05-15 16:04:44 +03:00
Denis Zharkov beb9a72e9d FIR: Optimize constructor of FirTowerResolverSession 2020-05-15 16:04:44 +03:00
Denis Zharkov 2e91bf7e50 FIR: Minor. Clarify name for addNonLocalTowerDataElements 2020-05-15 16:04:44 +03:00
Denis Zharkov 288db4fb1c Revert "FIR: make both ImplicitReceiverStack.get implementations consistent"
This reverts commit b058ca635c.

Change is not necessary anymore since there are no kinds for implicit
receivers
2020-05-15 16:04:44 +03:00
Denis Zharkov 808355d817 FIR: Fix test data for secondary constructor delegation calls
They appeared, after the changes in previous commits at
org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer#transformDelegatedConstructorCall

The idea is that dispatch receiver is available there in old FE, but additional
diagnostic should be reported on it (see KT-38813)

This change was not made intentionaly but it was the easiest way to
support new tower data elements structure and on the other side it's the
correct behavior as for old FE.

Also, if we once would prefer the previous behavior it's still not very
hard to support it
2020-05-15 16:04:44 +03:00
Denis Zharkov f71a56e742 FIR: Fix test data after rewritten scope structure
Mostly, the semantics for statics/companions has been changed there
Fixed test data now is much closer to semantics of old FE
2020-05-15 16:04:44 +03:00
Denis Zharkov f64c12efac FIR: Drop MutableImplicitReceiverStack and its implementation 2020-05-15 16:04:44 +03:00
Denis Zharkov 35e3942afb FIR: Drop unused ImplicitDispatchReceiverKind 2020-05-15 16:04:44 +03:00
Denis Zharkov 0ef1628751 FIR: Refactor scope structure on body resolve stage
Before this change:
- Local scopes, implicit receivers and type parameter scopes were separated.
- Static scopes for super classes were not present as a concept.
Instead of them, all-inherited-static for the current class has been used.
- During call resolution we were processing implicit receivers first and then non-local scopes,
while we should process them in the order of their syntax appearance from the closest
to the most distant

All these facts affect semantics (see test data changed here and the following commits)

The architecture changes are the following:
- FirTowerDataElement introduced as tower level that is used in resolution
  (effectively it's a union type between scope and implicit receiver + isLocal flag)
- FirTowerDataContext introduced for sake of encapsulation of tower data elements' list
  (it also has redundant implicitReceiverStack and localScopes)
- For each regular class we collect relevant tower data elements and add them to the current context
- Also, we preserve a special tower data context for static entities of the class
  (it doesn't have class' dispatch receiver and generic parameters)
2020-05-15 16:04:44 +03:00
Denis Zharkov cee38e0800 FIR: Implement FirScopeProvider.getStaticScope
It will be used in the following commits
2020-05-15 16:04:44 +03:00
Denis Zharkov 5268802d5d FIR: Minor. Move "storeFunction" call to transformSimpleFunction
It's only neede there and also scope structure will be cleaned up after transformFunctionWithGivenSignature
in the following commits
2020-05-15 16:04:44 +03:00
Denis Zharkov 3d6eedc962 FIR: Do not store nested local classes to local scopes 2020-05-15 16:04:44 +03:00
Denis Zharkov 07be2ae5c7 FIR: Use containers structure in FirContractResolveTransformer
transformDeclarationContent call remembers the container
2020-05-15 16:04:44 +03:00
Denis Zharkov a67e9966b8 FIR: Adapt DataFlowAnalyzer to PersistentReceiverStackImpl
It will be used as main implementation in further commits
2020-05-15 16:04:44 +03:00
Denis Zharkov 687a58843f FIR: Rewrite visibility checking
Unbound it from implicit receiver stack as it only needs scope structure/declaration nestedness
Semantics for protected has been changed in a way it works in old FE

NB: We should report additional diagnostic in case of CallCompanionProtectedNonStatic.fir.kt
(see KT-38814)
2020-05-15 16:04:44 +03:00
Denis Zharkov 825cdd3841 FIR: Move PersistentImplicitReceiverStack to resolve module 2020-05-15 16:04:44 +03:00
Denis Zharkov e8232fe471 FIR: Remove unused TowerGroupKind.Static 2020-05-15 16:04:44 +03:00
Denis Zharkov 56c793ffc6 FIR: Minor. Extract FirDeclarationsResolveTransformer::doTransformRegularClass
It's will be useful in the following commits
2020-05-15 16:04:44 +03:00
Denis Zharkov 7489b9f636 FIR: Minor. Inline processMembersForExplicitReceiver 2020-05-15 16:04:44 +03:00
Denis Zharkov fee639258c FIR: Simplify file imports scope tracking 2020-05-15 16:04:44 +03:00
Denis Zharkov 8a51bb7810 FIR: Minor. Unbound FirTowerResolverSession from FirLocalScope 2020-05-15 16:04:44 +03:00
Denis Zharkov 8363671cab FIR: Inline constructor parameter at FirTowerResolverSession 2020-05-15 16:04:44 +03:00
Denis Zharkov 75c4239504 Add "*.png binary" to .gitattributes 2020-05-15 16:04:44 +03:00
Toshiaki Kameyama 1d39ac1d3e Move statement: do not move when function last parameter is on same line as right parenthesis
#KT-14757 Fixed
2020-05-15 15:02:58 +02:00
Jinseong Jeon 615636ed55 FIR2IR: apply SAM conversion to arguments of functional type. 2020-05-15 15:08:43 +03:00
Vladimir Dolzhenko 599c5dd474 Collect unique subtypes from incremental compilation cache 2020-05-15 10:48:55 +00:00
Vladimir Dolzhenko 2f3ff10204 formatting clean up 2020-05-15 10:48:54 +00:00
simon.ogorodnik e101f88b50 [FIR] Add lines per second metric 2020-05-14 20:58:27 +03:00
Toshiaki Kameyama 8a595ad165 Move statement: Add or remove empty lines correctly
#KT-14946 Fixed
2020-05-14 18:57:56 +02:00
Victor Petukhov 73dec25eb1 NI: intersect DFI types before capturing
^KT-37887 Fixed
2020-05-14 19:54:59 +03:00
Toshiaki Kameyama 5a7ceec985 Color settings: use "Static field" instead of "Instance field" for "Enum entry" language defaults
#KT-15143 Fixed
2020-05-14 18:40:00 +02:00
Ilya Gorbunov 0e67e8e747 Advance bootstrap to 1.4.0-dev-8447 2020-05-14 19:35:00 +03:00
Roman Artemev 34bdd95e50 [JS SCRIPT] Enable js script test along with other script tests 2020-05-14 17:58:33 +03:00
Roman Artemev 9d9930f748 [JS SCRIPT] Fix test dependencies
- make sure kotlin stdlib is compiled and accessible
2020-05-14 17:58:33 +03:00
Roman Artemev 0e21dd15ba [JS SCRIPT] Fix script test data 2020-05-14 17:58:33 +03:00
Roman Artemev 31af1e6ca7 [JS SCRIPT] Fix ScriptDependencyCompiler
- Invoke KotlinIrLinker properly
2020-05-14 17:58:33 +03:00
Roman Artemev 52a93f189e [JS SCRIPT] Fix IrBuiltIns to make it stable if symbols already defined 2020-05-14 17:58:32 +03:00
Roman Artemev 8f71bdbf01 [JS SCRIPT] Fix IrScript visit order 2020-05-14 17:58:32 +03:00
Roman Artemev f792c5c936 [JS SCRIPT] Fix default arguments in script 2020-05-14 17:58:32 +03:00