Commit Graph

1681 Commits

Author SHA1 Message Date
Dmitriy Novozhilov d49c198a7f [FIR] Correctly initialize extensions in all sessions 2020-05-24 18:04:47 +03:00
Dmitriy Novozhilov 96da6d35c5 [FIR] Add processor for transforming statuses with plugins 2020-05-24 18:04:47 +03:00
Dmitriy Novozhilov 8d686226c7 [FIR] Introduce FirResolveProcessors 2020-05-24 18:04:47 +03:00
Dmitriy Novozhilov 3de12f9b09 [FIR] Completely remove old extensions service 2020-05-24 18:04:47 +03:00
Dmitriy Novozhilov 9a8d520b85 [FIR] Remove first version of class generation transformer 2020-05-24 18:04:46 +03:00
Dmitriy Novozhilov 3e3387fb69 [FIR] Remove extension status transformation from status resolve 2020-05-24 18:04:46 +03:00
Dmitriy Novozhilov 006232dfb2 [FIR] Fix FirPluginAnnotationsResolveTransformer 2020-05-24 18:04:46 +03:00
Dmitriy Novozhilov 206a646195 [FIR] Use caches for predicate matching 2020-05-24 18:04:45 +03:00
Dmitriy Novozhilov 594a854b4e [FIR] Reimplement FirExtensionService
- Get rid of old FirExtensionsService
- Implement new FirExtensionService
- Remove duplicating code in FirExtensionRegistrar
2020-05-24 18:04:45 +03:00
Dmitriy Novozhilov 5c12b3df95 [FIR] Introduce FirPredicateBasedProvider 2020-05-24 18:04:45 +03:00
Dmitriy Novozhilov 0b00015424 [FIR] Deprecate FirExtensionsService 2020-05-24 18:04:44 +03:00
Dmitriy Novozhilov f3d4fa715e [FIR] Introduce DeclarationPredicates for matching declarations for extensions 2020-05-24 18:04:44 +03:00
Dmitriy Novozhilov f764baad82 [FIR] Add extension with additional checkers 2020-05-24 18:04:43 +03:00
Pavel Kirpichenkov 0b33e9430b [NI] Report unstable smart cast directly instead of using SmartCastManager
Fix compilation errors, revealed by this fix.

SmartCastManager is unnecessary for error reporting, intermediate diagnostics from the NI contain all required infromation.
When SmartCastManager is used it leads to missing unstable smart casts in case of expressions with captured types.
This happens, because data flow info is recorded for original expression without captured types, which is used as a key.
DataFlowValues created from receivers with captured types can't be used to retrieve that info.

^KT-39010 Fixed
2020-05-21 17:09:10 +03:00
Jinseong Jeon 7a947e8008 FIR: fix default constructor visibility for enum entry. 2020-05-21 08:40:03 +03:00
Dmitriy Novozhilov dc57d307f3 [FIR] Clean data flow context before body resolve of file 2020-05-20 10:41:03 +03:00
Dmitriy Novozhilov 8df635a4e0 [FIR] Add cleanup of tower data for imports 2020-05-20 10:41:02 +03:00
Dmitriy Novozhilov b05546dd64 [FIR] Add check for session consistency in body resolve transformer 2020-05-20 10:41:02 +03:00
Dmitriy Novozhilov 371757309e [FIR] Don't recreate transformer in FirBodyResolveTransformerAdapter 2020-05-20 10:41:01 +03:00
Dmitriy Novozhilov 4e07f8180b [FIR] Don't recreate transformer in FirImplicitTypeBodyResolveTransformerAdapter 2020-05-20 10:41:01 +03:00
Dmitriy Novozhilov c4407d6d63 [FIR] Don't recreate transformer in FirContractResolveTransformerAdapter 2020-05-20 10:41:00 +03:00
Dmitriy Novozhilov c1080989b6 [FIR] Suppress pointless unchecked casts in FirStatusResolveTransformer 2020-05-20 10:41:00 +03:00
Dmitriy Novozhilov 329af65996 [FIR] Get rid of FirStatusResolveTransformerAdapter 2020-05-20 10:40:59 +03:00
Dmitriy Novozhilov 93992d1d75 [FIR] Get rid of FirTypeResolveTransformerAdapter 2020-05-20 10:40:58 +03:00
Dmitriy Novozhilov ca4deec10e [FIR] Don't recreate transformers in FirSupertypeResolverTransformer 2020-05-20 10:40:58 +03:00
Dmitriy Novozhilov dc30bf5d09 [FIR] Don't recreate transformers in FirPluginAnnotationsResolveTransformer 2020-05-20 10:40:57 +03:00
Dmitriy Novozhilov f60c8eac71 [FIR] Don't rewrite session in FirImportResolveTransformer 2020-05-20 10:40:56 +03:00
Dmitriy Novozhilov 67a259a903 [FIR] Get rid of FirSymbolProvider.getInstance(session)`
Replace with `session.firSymbolProvider`
2020-05-20 10:40:56 +03:00
Dmitriy Novozhilov 24c8a659ee [FIR] Add FirSession as parameter for FirTotalResolveTransformer 2020-05-20 10:40:55 +03:00
Mark Punzalan 89d706972c [FIR] Use vararg element type when generating argument mapping. 2020-05-19 15:41:29 +03:00
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +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 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 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