Commit Graph

517 Commits

Author SHA1 Message Date
sebastian.sellmair 4a6366ed9b [Commonizer] TargetDependent: Implement inline map functions 2021-09-22 06:45:01 +00:00
sebastian.sellmair b424800714 [Commonizer] Implement additional 'ParameterizedTypesCommonizationTest'
^KT-48288
2021-09-22 06:45:00 +00:00
sebastian.sellmair 4349f98954 [Commonizer] Fix CirConversions and substitute arguments
CirConversions did not cover some potential convertible types.
ClassOrTypeAliasTypeCommonizer did not apply type substitution
for parameterized types coming from a dependency

^KT-48288
2021-09-22 06:45:00 +00:00
sebastian.sellmair e2343094ec [Commonizer] Adapt CirUnderscoredTypeAliasSubstitutorTest
^KT-48288
2021-09-22 06:44:59 +00:00
sebastian.sellmair 9d2553bd18 [Commonizer] Adapt TypeCommonizerTest
^KT-48288
2021-09-22 06:44:59 +00:00
sebastian.sellmair 36a5b53398 [Commonizer] AbstractCommonizerTest.doTestFailure: Support single invocation commonizers
^KT-48288
2021-09-22 06:44:58 +00:00
sebastian.sellmair 4e6ad03df6 [Commonizer] Fix AbstractListCommonizer and adapt ValueParameterListCommonizerTest
^KT-48288
2021-09-22 06:44:58 +00:00
sebastian.sellmair cdd917bd0b [Commonizer] Adapt ExtensionReceiverCommonizerTest
^KT-48288
2021-09-22 06:44:58 +00:00
sebastian.sellmair 35a29acdc7 [Commonizer] Always use parent arguments for type substitution 2021-09-22 06:44:57 +00:00
sebastian.sellmair 5c7ac614ce [Commonizer] Remove old implementations for type commonization
Removed AliasedTypeSubstitutor: Covered by ClassOrTypeAliasTypeCommonizer
Removed ClassTypeCommonizer: Covered by ClassOrTypeAliasTypeCommonizer
Removed type alias substitution transformers: Covered by CirCommonClassifierId

^KT-48288
2021-09-22 06:44:57 +00:00
sebastian.sellmair bfa433fa06 [Commonizer] Split type substitution into forward and backwards
^KT-48288
2021-09-22 06:44:56 +00:00
sebastian.sellmair 698b3fce9e [Commonizer] ClassOrTypeAliasTypeCommonizer: Support 'enableOptimisticNumberTypeCommonization'
^KT-48288
2021-09-22 06:44:56 +00:00
sebastian.sellmair 595cab2aaf [Commonizer] ClassOrTypeAliasTypeCommonizer: Implement proper type argument substitution
^KT-47574 Verification Pending
2021-09-22 06:44:56 +00:00
sebastian.sellmair c1f118e502 [Commonizer] Include dependencies in CirCommonClassifierId
^KT-48288
2021-09-22 06:44:55 +00:00
sebastian.sellmair ef6f84b151 [Commonizer] Implement ClassOrTypeAliasTypeCommonizer with type substitution
^KT-48288
2021-09-22 06:44:55 +00:00
sebastian.sellmair 97e37243c6 [Commonizer] Move type commonization to single invocation commonizer
^KT-48288
2021-09-22 06:44:54 +00:00
sebastian.sellmair 3ee87f1635 [Commonizer] Use typealias invariant Approximation Keys
^KT-48288
2021-09-22 06:44:54 +00:00
sebastian.sellmair 763ddcddf4 [Commonizer] Implement CirCommonClassifierId & CirCommonClassifierIdResolver
This common representation of a classifier id can later be used
to render typealias invariant approximation keys.

^KT-48288
2021-09-22 06:44:54 +00:00
sebastian.sellmair a3d60f8ed2 [Commonizer] Minor: Don't unnecessarily capture size as local property 2021-09-07 11:36:48 +00:00
sebastian.sellmair f3e55aeac0 [Commonizer] Rename type parameter from 'Context' to 'T'
NullableContextualSingleInvocationCommonizer:
Naming the type parameter 'Context' might provoke different/
misleading intuitions for many.

https://jetbrains.team/im/code/KFc0x1LxezP?message=BDpl60SJkVM&channel=2Ty4Ld4L0Aer

^KT-48567
2021-09-07 11:36:48 +00:00
sebastian.sellmair 2e053be703 [Commonizer] ReturnTypeCommonizer: Only allow covariant nullability for covariant types
The return type of any property with a setter can be considered invariant
and should enable covariant nullability commonization

^KT-48567
2021-09-07 11:36:47 +00:00
sebastian.sellmair 9e34382db5 [Commonizer] Implement TypeNullabilityCommonizer and ReturnTypeCommonizer
^KT-48567 Verification Pending
2021-09-07 11:36:47 +00:00
sebastian.sellmair b13f3599cf [Commonizer] Initial implementation for nullable return type commonization
^KT-48567
2021-09-07 11:36:46 +00:00
sebastian.sellmair f56419cbf8 [Commonizer] Implement ReturnTypeNullabilityCommonizationTest
^KT-48567
2021-09-07 11:36:46 +00:00
sebastian.sellmair 5a63498963 [Commonizer] Use qualified name string for 'UnsafeNumber' annotation
^KT-48459
^KT-48455
2021-08-30 19:25:43 +00:00
sebastian.sellmair e7e3cedf69 [Commonizer] Finalize tests for ^KT-48455 2021-08-30 19:25:43 +00:00
sebastian.sellmair 60ccdf23ea [Commonizer] Choose lower bit width numbers for optimistic number commonization
^KT-48455
2021-08-30 19:25:43 +00:00
sebastian.sellmair 642bb68916 [Commonizer] Rename TargetDependentCommonizer.kt to SingleInvocationCommonizer.kt 2021-08-30 19:25:42 +00:00
sebastian.sellmair f7839e847a [Commonizer] Emit 'UnsafeNumber' for optimistically commonized typealias
^KT-48459 Verification Pending
2021-08-30 19:25:42 +00:00
sebastian.sellmair 814a147a53 [Commonizer] Implement optimistic number commonization for typealias
When typealias point to a number of different bit width on
certain platforms, this implementation will choose
the number type with higher bit width as commonization result
for typealias types and typealias underlying types.

This will effectively port the "analyse code for a single
selected platform" UX approach into HMPP (for numbers only)

^KT-48455 Verification Pending
2021-08-30 19:25:41 +00:00
sebastian.sellmair 565ea2c4f5 [Commonizer] Improve iteration performance in transformer and mergeCirTree
An allocation/iterator free `forEach` is used for lists that
are not intended to be modified at the same time.
2021-08-19 12:19:15 +00:00
sebastian.sellmair e2816ffabb [Commonizer] Rename CirTypeSubstitutor implementations
^KT-48287
^KT-48286
2021-08-19 12:19:14 +00:00
sebastian.sellmair 8aceff3641 [Commonizer] Implement CirUnderscoredTypeAliasSubstitutor
Try substituting TypeAlias types that start with `__` in favour
of TypeAlias without the underscored prefix

^KT-48287 Verification Pending
^KT-48286 Verification Pending
2021-08-19 12:19:14 +00:00
sebastian.sellmair 68e7476765 [Commonizer] ClassSuperTypeCommonizer: Don't find consumed TypeNodes
This commit will also add some simple documentation
to this class and its implementation.

^KT-47430
2021-08-16 10:44:04 +00:00
sebastian.sellmair 1e95717b8d [Commonizer] Implement SimpleCirSupertypesResolverTest
^KT-47430
2021-08-16 10:44:03 +00:00
sebastian.sellmair f64a0efa8b [Commonizer] Respect artificial supertypes when loading dependencies
CirProvided.ExportedForwardDeclarationClass will now correctly
report artificial superclasses.

The InlineTypeAliasCirNodeTransformer does not need to know anything
about artificial supertypes anymore. When inlining any
type alias, it is enough to resolve the type-alias's expansions
supertypes.

^KT-47430
2021-08-16 10:44:03 +00:00
sebastian.sellmair 26ede5d885 [Commonizer] Add small documentation on CirSupertypesResolver
^KT-47430
2021-08-16 10:44:03 +00:00
sebastian.sellmair 9fb41b6334 [Commonizer] CirKnownClassifiers: Store indices and target dependencies as 'TargetDependent'
^KT-47430
2021-08-16 10:44:02 +00:00
sebastian.sellmair 367db345a8 [Commonizer] Do not re-calculate classifier indices for transformer
^KT-47430
2021-08-16 10:44:02 +00:00
sebastian.sellmair dda9bb93f6 [Commonizer] Consider exportForwardDeclarations as dependency
This will make follow-up commits easier:
forward declarations are closer to dependencies than being part
of the library. They will be used in the module, bot not
directly provided.

This commit also enables tracking of provided dependency classifiers
in the CirTreeRoot and CirRootNode

^KT-47430
2021-08-16 10:44:01 +00:00
sebastian.sellmair 3d4e861f05 [Commonizer] ModulesProvider: refactor 'loadModuleInfos()' to property
This is done to signal that accessing this data is indeed lightweight.

^KT-47430
2021-08-16 10:44:01 +00:00
sebastian.sellmair 6c246738a5 [Commonizer] TargetDependent: Support index based access
^KT-47430
2021-08-16 10:44:01 +00:00
sebastian.sellmair dff392f2cd [Commonizer] ClassSuperTypeCommonizer: Include transitive supertypes
This commit still has some left-over todos that shall be done
in a separate commit.

TODOs:
- CirClassifierIndex is calculated once too often
- Reconsider position of classifierIndices in 'CirKnownClassifiers'
- Add documentation/description to complicated 'ClassSuperTypeCommonizer'
- Add documentation/description to CirSupertypesResolver

^KT-47430 Verification Pending
2021-08-16 10:44:00 +00:00
sebastian.sellmair 1857096071 [Commonizer] Implement ClassSuperTypeCommonizer
This implementation runs as regular part of the commonization.
Previous implementation inside the CommonizationVisitor was fully
replaced by it.

As a side effect: CirClass.supertypes was now marked immutable.

^KT-47430 In Progress
2021-08-16 10:44:00 +00:00
sebastian.sellmair 50a343f91e [Commonizer] Deserialize supertypes from provided dependencies
^KT-47430 In Progress
2021-08-16 10:43:59 +00:00
sebastian.sellmair cdfe8d60a4 [Commonizer] InlineTypeAliasCirNodeTransformer: add artificial supertypes
When inlining any TypeAlias pointing towards forward declarations,
the inlined class will respect implicit supertypes.

This logic is analog to
KlibResolvedModuleDescriptorsFactoryImpl.createForwardDeclarationsModule

^KT-47430 In Progress
2021-08-16 10:43:59 +00:00
Alexander Udalov 069e040af9 Fix warnings in kotlin-klib-commonizer 2021-08-06 22:37:00 +02:00
sebastian.sellmair 9500b2d36e [Commonizer] Add HierarchicalCInteropCallableAnnotationCommonizationTest.test single platform not marked as objc 2021-07-15 10:04:45 +00:00
sebastian.sellmair 17ed498390 [Commonizer] approximationKeys: Fix closing ] for type parameter types' upper bounds 2021-07-15 10:04:45 +00:00
sebastian.sellmair daa046589e [Commonizer] approximationKeys: Minor cleanup of buildApproximationSignature 2021-07-15 10:04:44 +00:00