Commit Graph

499 Commits

Author SHA1 Message Date
Vladimir Dolzhenko e511eec90e Added optimized PackageFragmentProvider#isEmpty(FqName) 2021-04-09 09:27:39 +00:00
Ilya Gorbunov e450a6494a Migrate deprecations in core, compiler, idea, tests
Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
2021-04-07 18:30:20 +03:00
Ilya Kirillov 6f887896ff FIR IDE: use CallableId for KtCallableSymbol instead of FqName 2021-03-24 18:13:04 +01:00
Alexander Udalov e0b6d4d917 Add -Xsuppress-deprecated-jvm-target-warning to modules compiled with 1.6
Currently this leads to an unknown argument warning, but it'll be
removed automatically on the next bootstrap.
2021-02-03 12:51:39 +01:00
Alexander Udalov b7d32a8754 Minor, invert analysis flag that allows unstable dependencies 2020-12-20 23:13:50 +01:00
Andrei Klunnyi 3af0257b38 KTIJ-664 [SealedClassInheritorsProvider]: IDE-specific implementation 2020-12-15 18:43:00 +01:00
Dmitriy Novozhilov 6809adee9c [FE] Extract computation of sealed class inheritors into separate component
This is needed to provide more optimal provider in IDE plugin
2020-12-09 22:54:31 +03:00
Dmitriy Novozhilov e76acc8ee0 [FE] Collect inheritors of sealed classes from new places in computeSealedSubclasses
#KT-13495
2020-12-09 22:54:24 +03:00
Ilmir Usmanov 361ed117bb Value classes: Add isValue property to class descriptors
Reuse isInline flag in proto and IR.
Check metadata version on deserialization.
2020-11-27 23:52:05 +01:00
Roman Golyshev ebfbc2f601 KT-43205 Ignore annotations in CallableClsStubBuilder when needed
Kotlin compiler can add `@Deprecated` annotations to the fields of
private companion objects, and if those annotations are not supposed to
be shown in decompiled code and used, the field is marked with
`HAS_ANNOTATIONS=false` flag (see KT-25009)

However, it was not taken into account in stubs building process, which
led to the 'Stubs vs PSI mismatch' exceptions

^KT-43205 Fixed

Also, restore the order of nested typealiases and classes (see KT-41859)

We didn't want to bump the version of the stubs when we fixed this
issue; now we have an opportunity to restore the order back to
match the `MemberComparator`

Also, some refactoring is done to underscore that
`createPackageDeclarationsStubs` is suitable only for packages, not
for any declarations container
2020-11-09 15:49:50 +00:00
Alexander Udalov b2d49e9615 Minor, fix whitespace in toString 2020-11-06 19:26:49 +01:00
Mikhail Zarechenskiy bb2e9e2d56 Extract new method from the publicly used interface for compatibility
Note that we can't just use ``@JvmDefault` annotation as the main change
 is in the `core` module which targets Java 6

 #KT-42259 Fixed
2020-10-27 14:14:39 +03:00
Vladimir Dolzhenko 3c380faeb5 Added deprecated PackageFragmentProvider#getPackageFragments for BWC
Relates to ^KT-33394
^KT-42259 Fixed
2020-09-29 19:14:44 +00:00
Roman Golyshev 945edfe987 KT-41859 Place classes after typealiases in DeserializedMemberScope
This way, the order in stubs and in deserialized text would be the same

On the next stub version bump, this fix should be reworked: the order
in the `DeserializedMemberScope` should be restored, and the order in
the stubs should be fixed to match the order in `MemberComparator`

^KT-41859 Fixed
2020-09-25 09:03:12 +00:00
Roman Golyshev 6d0a5a0bb2 KT-41346 Implement NoReorderImplementation without reordering
- See the documentation for `DeserializedMemberScopeHelper` for the full
info about the fix and the issue
- Add `preserveDeclarationsOrdering` setting to
`DeserializationConfiguration`
- Enable this setting in `DeserializerForClassfileDecompiler`
- Also, use `List` instead of `Collection` to pass members to
`DeserializedMemberScope`. It is done to emphasize that the order of
the members is important and may be used
- Review: https://jetbrains.team/p/kt/review/1627
- ^KT-41346 Fixed
2020-09-23 15:27:51 +00:00
Roman Golyshev bf371ff98a KT-41346 Refactor computeNonDeclared*
Change the signature of the `computeNonDeclared*` methods so they expect
mutable lists - it better suits their contracts. Also, add a little
documentations about the contract

Also, change `Collection` to `List` for incoming protos to `emphasize`
that their order might be used
2020-09-23 15:27:50 +00:00
Roman Golyshev b1097c49d3 KT-41346 Move Implementation to DeserializedMemberScope 2020-09-23 15:27:49 +00:00
Roman Golyshev 5596bf33d8 KT-41346 Move related code to OptimizedImplementation
This does not change any semantics, only moves the code around
2020-09-23 15:27:49 +00:00
Roman Golyshev c8878f862d KT-41346 Introduce inner OptimizedImplementation class
Make it implement `Implementation` and move definitions
there
2020-09-23 15:27:48 +00:00
Roman Golyshev 683dd57f24 KT-41346 Extract Implementation interface
This is a temporary interface to make refactoring easier
2020-09-23 15:27:47 +00:00
Roman Golyshev 341a7478ed KT-41346 Move removing non-available functions to protected method
This would allow to stricten contract on `computeNonDeclaredFunctions`
2020-09-23 15:27:47 +00:00
Roman Golyshev 4f4c25ca5e KT-41346 Cleanup DeserializedMemberScope 2020-09-23 15:27:46 +00:00
Dmitriy Novozhilov 07a3009d43 Introduce new modules for common parts of deserialization 2020-09-11 10:08:37 +03:00
Dmitriy Novozhilov 5d4d07066b Move common deserialization components to :core:metadata and :core:metadata.jvm 2020-09-11 10:08:35 +03:00
Dmitriy Novozhilov 8d2e89a9ea Move ProtoEnumFlags to :core:metadata 2020-09-11 10:08:34 +03:00
Vladimir Dolzhenko 5036673187 Improve package caching in KotlinJavaPsiFacade
^KT-33394 Fixed
2020-09-10 07:38:46 +00:00
Dmitriy Novozhilov 6906e0d82d Move common jvm classes from :core:descriptors.jvm to :core:compiler.common.jvm 2020-09-04 11:42:51 +03:00
Dmitriy Novozhilov d1fd1da56f Rename Visibility to DescriptorVisibility 2020-09-04 11:07:42 +03:00
Alexander Udalov a9ddf02556 Replace deprecated usages of max/min with maxOrNull/minOrNull 2020-08-25 20:33:59 +02:00
Dmitriy Novozhilov 5fa80a2f8c Merge :core:deserialization:deserialization.common into :core:descriptors.common 2020-08-25 10:41:34 +03:00
Dmitriy Novozhilov 167f18b738 Move SourceElement and SourceFile to :deserialization.common
Remove dependency on `:core:descriptors` from `:core:deserialization:deserialization.common`
2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov a764732020 Rename KotlinBuiltInsNames to StandardNames 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov 6f0cd14afa Move common classes to new :core:deserialization:deserialization.common module 2020-08-25 10:31:37 +03:00
Dmitriy Novozhilov 7a7fe77b8e Move static constants with builtin names to :core:descriptors.common module 2020-08-25 10:31:36 +03:00
Sergey Igushkin f6356199d3 Fix typealias usage nullability and annotations lost in deserialization
Issue #KT-40824 Fixed
2020-08-06 15:46:54 +04:00
Sergey Igushkin 093d4b3108 Revert "Fix typealias usage nullability and annotations lost in deserialization"
This reverts commit 070848a1
2020-08-05 20:17:49 +04:00
Sergey Igushkin 070848a1c1 Fix typealias usage nullability and annotations lost in deserialization
This fixes a regression introduced by the commit 4b0da0688a which made
deserializer expand typealiases but didn't take nullability and use site
annotations into account.

Issue #KT-40824 Fixed
2020-08-05 00:19:52 +04:00
Dmitriy Dolovov 3d9093583f Metadata: 'non-stable parameter names' flag for callables
^KT-34602
2020-07-27 23:11:30 +07:00
Alexander Udalov 8c71d8f126 Undeprecate VariableDescriptorWithAccessors.isDelegated
Apparently there's quite a few valid usages of this method outside of
the compiler frontend, where manual suppression is annoying.
2020-07-07 18:09:40 +02:00
Denis Zharkov 3ce980fd88 Fix incremental compilation for calls to inner classes from supertypes
The problem became actual after 8c2baf0704
2020-07-01 06:55:52 +03:00
Alexander Udalov a0400f59c2 Add -Xskip-prerelease-check compiler argument
#KT-38070 Fixed
2020-05-07 13:24:26 +02:00
Sergey Igushkin 4b0da0688a Fix expect discrimination with actual typealias in deserialization
* For types encountered during deserialization, search for a classifier,
  not necessarily a class, across module dependencies (i.e. accept type
  aliases, returned when actual type alias discriminates an expect
  class).

* When the referenced type is a type alias, expand it, so that when
  the descriptor is compared to the expansion in other places,
  they match.

* Also, when resolving an abbreviation, don't expand the type aliases,
  as there are assumptions in the code base that an abbreviation is a
  type alias.
2020-04-24 12:54:38 +03:00
Alexander Udalov 92534eadaa Remove dependency of 'resolution' on 'deserialization'
Replace it with a dependency on 'descriptors'.

Move the existing marker interface ContractProvider to 'descriptors',
and create a new marker interface DeserializedDescriptor.
2020-03-28 21:30:07 +01:00
Alexander Udalov 795d6ab407 Migrate UseExperimental->OptIn in project sources 2020-03-10 12:07:14 +01:00
Roman Artemev bb43a66716 [Metadata] Add platform dependent type transformer
- Fix forward declaration type construction
2020-02-26 14:55:54 +03:00
Roman Artemev 6a37955a36 [KLIB] Implement new linker based on IdSignature
- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
2020-02-14 18:22:16 +03:00
Roman Artemev df7b7cf61a [K/N] Provide original class id for forward-declared declarataion 2020-02-14 18:22:15 +03:00
Alexander Udalov 953b461c53 Add new compiler errors and flags when JVM compiles against JVM IR
From now on, the old JVM backend will report an error by default when
compiling against class files produced by the JVM IR backend. This is
needed because we're not yet sure that the ABI generated by JVM IR is
fully correct and do not want to land in a 2-dimensional compatibility
situation where we'll need to consider twice more scenarios when
introducing any breaking change in the language. This is generally OK
since the JVM IR backend is still going to be experimental in 1.4.

However, for purposes of users which _do_ need to compile something with
the old backend against JVM IR, we provide two new compiler flags:
* -Xallow-jvm-ir-dependencies -- allows to suppress the error when
  compiling with the old backend against JVM IR.
* -Xir-binary-with-stable-api -- allows to mark the generated binaries
  as stable, when compiling anything with JVM IR, so that dependent
  modules will compile even with the old backend automatically. In this
  case, the author usually does not care for the generated ABI, or s/he
  ensures that it's consistent with the one expected by the old compiler
  with some external tools.

Internally, this is implemented by storing two new flags in
kotlin.Metadata: one tells if the class file was compiled with the JVM
IR, and another tells if the class file is stable (in case it's compiled
with JVM IR). Implementation is similar to the diagnostic reported by
the pre-release dependency checker.
2020-01-29 17:20:41 +01:00
Mikhail Zarechenskiy 0e90d538df FIC: propagate info about conversions for deserialized classes 2020-01-17 19:36:08 +03:00
Mikhail Zarechenskiy cd5c1b96bb Refactoring: move SamConversionResolver to more applicable package 2020-01-17 19:36:07 +03:00