Commit Graph

29688 Commits

Author SHA1 Message Date
Victor Petukhov eff5f3a242 NI: do type checking for anonymous functions not inside a call
^KT-38890 Fixed
^KT-38439 Fixed
2020-05-19 16:29:14 +03:00
Mark Punzalan 425ce8c3ab [FIR] Use flexible type lower bound when approximating type for
IntegerLiteral.
2020-05-19 15:42:49 +03:00
Mark Punzalan d5141674a3 [FIR] Update GenerateRangesCodegenTestData for newly-enabled FIR tests. 2020-05-19 15:41:29 +03:00
Mark Punzalan 89d706972c [FIR] Use vararg element type when generating argument mapping. 2020-05-19 15:41:29 +03:00
Ilya Matveev 839e4ecff2 Allow passing a MessageRenderer to CLITool.mainNoExit
Earlier a system property was used to configure a message renderer
for the K/N compiler. The fix for KT-37550 requires getting rid of
using properties when the compiler is started in a Gradle process.
This patch allows us to specify a correct message renderer at
the K/N side depending on entry point used to run the compiler.

 Issue #KT-37550
2020-05-19 18:57:41 +07:00
Mark Punzalan 371c4561a0 [IR/FIR] Use isExpect from IR element instead of descriptor in
ExpectDeclarationRemover.
2020-05-18 17:20:43 +02:00
Mikhail Glukhikh db7a7f6cd3 [FIR2IR] Move facade classes generation to the main converter 2020-05-18 11:48:33 +03:00
Mikhail Glukhikh c4f4883b96 [FIR] Remove redundant dependency generation in JvmIrCodegenFactory
Dependency generation isn't necessary at this point because
it's already performed by Fir2IrConverter
2020-05-18 11:48:33 +03:00
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +03:00
Jinseong Jeon 61def4cdc5 FIR: set function factory (before it's used in SAM lowering). 2020-05-18 09:36:22 +03:00
Ilya Chernikov fb6ef38370 Revert "Add info about the end of range in scripting REPL compiler messages"
This reverts commit af251caf, because it breaks daemon/client
compatibility, which we'd like to keep as much as possible
2020-05-15 21:15:48 +02:00
Anton Bannykh c6f38ebfbf JS IR: enable scope expansion strategy for JS IR KLIB incremental generation 2020-05-15 19:23:52 +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
Jinseong Jeon 615636ed55 FIR2IR: apply SAM conversion to arguments of functional type. 2020-05-15 15:08:43 +03:00
simon.ogorodnik e101f88b50 [FIR] Add lines per second metric 2020-05-14 20:58:27 +03:00
Victor Petukhov 73dec25eb1 NI: intersect DFI types before capturing
^KT-37887 Fixed
2020-05-14 19:54:59 +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