Commit Graph

79 Commits

Author SHA1 Message Date
Pavel Kunyavskiy fd564d4af9 [K/N] Disable custom import for forward declarations
If forward declaration exists in a library, it was
possible to import it both by forward declaration name
and normal library name. This is strange unique behavior.
And it would also make KT-59643 changes binary incompatible.
So from now it's only possible to import forward declaration by
forward declaration name only.

^KT-59642
2023-07-24 08:24:20 +00:00
Pavel Kunyavskiy d797505f06 [K/N] Drop merging forward and real declaration in deserializer
^KT-59643
2023-07-24 08:24:20 +00:00
Svyatoslav Scherbina cba955cb3e Native, K1: add ExperimentalForeignApi to generated forward declarations
cinterop tool should add ExperimentalForeignApi to all generated
declarations, to indicate their experimental status and discourage using
them in public Kotlin API. But the same considerations are applicable
to forward declarations (cnames.*, objcnames.*), which are generated not
by cinterop tool, but directly by the compiler.

This commit adds ExperimentalForeignApi to those compiler-generated
classes.

^KT-58362
2023-07-21 17:44:09 +00:00
Pavel Kunyavskiy ef9413108b [K/N] Consolidate forward declarations handling
This is refactoring in preparation for KT-59764.
Names and layout of forward declarations related classes
was copy-pasted many times over compiler code.

Implementing KT-59764 would require copy-pasting it two more times.
So instead of doing this it was put in single place.

No behaviour changes intended in this commit.
2023-07-10 08:59:16 +00:00
Dmitriy Dolovov 56bebeaf92 [KLIB] Extract "ir_provider" manifest property name as a const val, p.2 2023-06-17 01:00:04 +00:00
Dmitriy Dolovov 72525a22a6 [KLIB] Extract "ir_provider" manifest property name as a const val 2023-06-15 11:07:30 +00:00
Anton Bannykh c839fdca3e [JS IR] initial support for KLIB incremental compilation with K2 2023-04-23 14:47:48 +02:00
Sergey Bogolepov 51d441ee38 [K/N] Fix KT-57541
Root cause: commonizer does not add `ExternalObjCClass` annotation
to expect declarations, so forward declarations aren't resolved.

It is simpler (and safer) to fix it on the compiler side by checking
superclass instead of annotation.
2023-03-31 09:05:52 +00:00
Svyatoslav Scherbina b19058caef K2/Native: support cinterop forward declarations
Support importing synthetic declarations from "magic" forward
declaration packages:
- cnames.structs
- objcnames.classes
- objcnames.protocols

So this is a rough equivalent to the forward declarations module
made of ForwardDeclarationsPackageFragmentDescriptor in K1.

Unlike K1 implementation, this K2 one doesn't allow importing
a declaration that wasn't actually forward-declared in a C/Objective-C
header available through a cinterop klib dependency.
2023-02-10 20:17:05 +00:00
Nikita Bobko 44b1cf6c46 Add docs for different metadata versions and proto files
Review: https://jetbrains.team/p/kt/reviews/8401
In scope of KT-55082
2023-02-01 15:13:34 +01:00
Ilya Goncharov 1150ec6882 [JS] Implementation dependencies for JS klibs
^KT-56158 fixed
2023-01-27 13:31:59 +00:00
Roman Efremov 878608b7b2 Don't add Enum.entries to scope if it can't be called
^KT-53929 Fixed
2023-01-23 12:53:06 +01:00
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Mikhail Glukhikh 89dd28226b BinaryVersion: introduce isCompatibleWithCurrentCompilerVersion 2023-01-16 18:12:55 +01:00
Svyatoslav Scherbina b1e3226ed5 K2: add KlibDeserializedContainerSource.isFromNativeInteropLibrary
This will be required when serializing IR symbols referring declarations
from interop libraries.
2023-01-11 11:47:45 +00:00
Svyatoslav Scherbina 5320fbeb6e K1: support pre-release checks for klibs
This commit makes the compiler read the pre-release flag from loaded
klibs. Now the K1 frontend checks this flag in
MissingDependencyClassChecker checker, reporting errors if the current
compiler configuration doesn't allow using pre-release dependencies.

^KT-54905 Fixed
2023-01-06 16:57:39 +00:00
Svyatoslav Scherbina 7788304645 Change klib PRE_RELEASE flag value to ignore it set in existing klibs
JsAllowValueClassesInExternals language feature had UNSTABLE_FEATURE
kind and was enabled by default for JS IR backend. As a result, klibs
compiled with recent compiler versions were marked with the pre-release
flag.

Now, if we enabled reading the flag from klibs, the JS IR compiler would
reject all these klibs by default. To fix that, this commit changes the
flag value from 0x1 to 0x2, so that all previously compiled klibs are
treated as not having the pre-release flag.
2023-01-06 16:57:39 +00:00
Svyatoslav Scherbina 0f63cfecbd Introduce KlibMetadataHeaderFlags
This class lists possible flags for KlibMetadataProtoBuf.Header, and
helps avoid using magic constants in the source code.
2023-01-06 16:57:38 +00:00
Svyatoslav Scherbina d9ba950d7b Introduce KlibDeserializedContainerSource
It is a DeserializedContainerSource implementation for deserializing
metadata from klibs.
2023-01-06 16:57:38 +00:00
Pavel Kunyavskiy 17e9a6a781 [klib] Fix serialization of missing annotations
^KT-42490
^KT-44625
2022-12-20 20:06:51 +00:00
Igor Chevdar 9732100764 [K/N][IR][codegen] Introduced DependenciesTracker 2022-12-20 14:24:54 +00:00
Igor Chevdar c88ac7cc86 [K/N][IR][codegen] Build per-file dependencies for caches 2022-12-20 14:24:54 +00:00
Sergej Jaskiewicz f8e6c59600 Add compatibility aliases for declarations moved from other packages
1539d7ef1a brought some package names in
sync with the directory layout. However, this broke some third-party
code that used classes from those packages.

The new compatibility aliases allow that code to continue to compile.
Deprecation warnings will be emitted, suggesting to replace the imported
packages with new ones.
2022-12-19 19:42:05 +00:00
Sergej Jaskiewicz 1539d7ef1a [klib] Bring package names in sync with the directory layout
Basically, some package names were Native-specific, whilst the packages
themselves were not Native-specific at all. This was already reflected
in the directory layout, but not in the package names.
This is fixed here.

NFC, just an automatic rename of packages with fixes of imports.
2022-12-01 21:46:43 +00:00
Sebastian Sellmair 752ff04245 [Gradle][Native] Setup refinesPaths as expectedBy module dependencies
Previously, dependsOn dependencies were just passed as friend modules
to shared native compilations.

^KT-55071 Verification Pending
2022-11-24 14:42:10 +00:00
Sergey Bogolepov 8e3d574913 [K/N] Check type of forward declaration in resolve
Fixes KT-49034
2022-06-24 23:57:12 +03:00
Svyatoslav Scherbina 54fb4d9b70 Native: make forward declarations expect in metadata compilations
If we are compiling metadata, make synthetic forward declarations
`expect`, because otherwise `getFirstClassifierDiscriminateHeaders`
would prefer it over a "real" `expect` declaration from a commonized
interop library, which would ruin the whole idea of using synthetic
forward declarations only when no proper definitions are found.

^KT-51377 Fixed
2022-03-11 15:09:38 +00:00
Igor Chevdar b474b570a4 [K/N][gradle] Supported friend modules for two stage compilation
Fixes https://youtrack.jetbrains.com/issue/KT-49248
2021-11-12 17:40:26 +05:00
Roman Artemev f05c8ad953 [JS IR] Fix js("...") call checker in frontend.
Call mather relies on that BuiltIn package fragment implement specific
interface `BuiltInsPackageFragment` which was missed. Make sure that
BuiltIn module's package fragments implement that interface.

Fix progression optimizer symbols resolve in JS & WASM IR BE
2021-09-28 18:15:51 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Sergey Bogolepov d5e2ac0efc Fix KotlinLibraryResolverImpl.kt on Windows
`absoluteFile` is not enough to make path unique. For example, it doesn't
expand things like '..' and 'IDEAPR~1' on Windows. `canonicalFile` seems
to solve the problem.
2021-08-04 05:44:27 +00:00
Dmitry Savvinov 708fead1cc Add debug strings to frontend scopes-related structures
Such as:
- PackageFragmentProviders, and, in particular,
CompositePackageFragmentProviders
- JavaPackageFragments
- Scopes produced by those providers

The rationale is that a lot of frontend-facing bugs (like red code) are
easily recognizeable in resolution. But at that point you just see a
bunch of scopes, without meaningful toStrings, you don't know who has
produced them, and what's exactly wrong.

With this commit it should make debugging slightly easier: now at least
you'll be able to see that "this scope is a scope of package fragment
for foo.bar of module baz" and decide whether the declaration should or
should not have been resolved from such scope.
2021-06-03 17:21:59 +03:00
Dmitriy Novozhilov d114913cd2 Replace usages of addToStdlib.firstNotNullResult with firstNotNullOfOrNull 2021-05-14 14:30:19 +03:00
sebastian.sellmair 75d9cd3814 [Minor] KotlinLibraryResolverImpl: Improve readability in resolveDependencies 2021-04-21 20:05:57 +00:00
sebastian.sellmair 22ea5c7de4 Demote fatal error to warning on unresolved libraries mentioned in Klib's manifest 'depends' for metadata compilation
^KT-46107
2021-04-21 20:05:55 +00:00
Vladimir Ivanov 61883ee878 Exclude kdoc related stuff from proto comparison in IC (#4283) 2021-04-07 17:16:06 +03:00
Vladimir Ivanov fd02802028 [Native] Export KDoc into generated native header 2021-03-09 16:50:23 +03:00
Roman Artemev b0adcffed9 [JS IR] Fix transitive dependency resolve 2021-01-26 19:23:25 +03:00
Pavel Kirpichenkov b66f5c8180 Drop type aliases for JS and KLIB string tables
They used to use the same approximation logic anyway
^KT-20996
2021-01-20 11:05:53 +03:00
Pavel Kirpichenkov 2f3f75b512 Fix local anonymous class name error in K2MetadataCompiler
Extract the logic of approximating to denotable class supertype
from JS/KLIB and use it in metadata compiler.

^KT-20996 In Progress
2021-01-20 11:05:53 +03:00
Dmitriy Novozhilov a764732020 Rename KotlinBuiltInsNames to StandardNames 2020-08-25 10:41:33 +03:00
Dmitriy Novozhilov 3a48265077 Move ModuleDescriptor.Capability to :core:descriptors.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
Roman Artemev 851c287105 [KLIB] Use SoftReference to hold proto memory
- fix metadata memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Dmitriy Dolovov 3d9093583f Metadata: 'non-stable parameter names' flag for callables
^KT-34602
2020-07-27 23:11:30 +07:00
Anton Bannykh e45cd02b01 KLIB: add EmptyPackageFragment's to fix ModuleDescritor.getSubPackagesOf 2020-07-15 20:42:23 +03:00
Dmitry Savvinov b07f89864e Allow dependencies to see internals from main module as well
^KT-38338 Fixed
2020-04-24 12:54:39 +03:00
Sergey Igushkin d4a0844a77 Support additional module descriptor dependencies in klib descriptors 2020-04-24 12:54:37 +03:00
Dmitriy Dolovov c35420eaf6 Minor. Add comments 2020-04-14 21:07:59 +07:00
Dmitriy Dolovov 8d2e999776 HMPP: Parameterize NativePlatform with KonanTarget 2020-04-14 21:06:48 +07:00