Commit Graph

96624 Commits

Author SHA1 Message Date
Anton Lakotka 14acbd990f [Gradle, Test] Update kotlin-js-plugin-project with sources publication
Sources are published now as gradle variant, so it shouldn't be added
manually to publication.

^KT-36943
2022-12-01 18:57:05 +00:00
Anton Lakotka 5023ccc724 [Gradle] Keep kotlinSourcesJar in Kotlin/JVM projects
After introducing sourcesElements for Multiplatform projects the task
was not registered. As result of an assumption that Java Gradle Plugin
is taking care of sources publication. But in fact some users can
still rely on Kotlin's `kotlinSourceJar` task instead of JGP's
`sourcesJar`. This look inconsistent and is a matter of a different
issue: KT-54207

^KT-36943
2022-12-01 18:57:04 +00:00
Anton Lakotka 51c33333ea [Gradle, Test] Update ConfigurationsTest after adding sourcesElements
^KT-36943
2022-12-01 18:57:04 +00:00
Anton Lakotka f72b67a5ca [Gradle] Update kotlin-gradle-plugin-api.api
Add new field `sourcesElementsConfigurationName` to KotlinTarget

^KT-36943
2022-12-01 18:57:03 +00:00
Anton Lakotka 032c3330ab [Gradle] Support sources publication as variants in ExternalKotlinTarget
^KT-36943
2022-12-01 18:57:03 +00:00
Anton Lakotka b7dff37734 [Gradle] Rename usageScope to mavenScope of KotlinUsageContext
and remove includeDependenciesToMavenPublication flag as it not
needed anymore.
2022-12-01 18:57:02 +00:00
Anton Lakotka 3fa85bf7fd [Gradle, MPP] Publish sources as gradle variants
Now when MPP library is published it will contain "sourcesElements"
variant for each target and one for common code.

Sources variants are published under gradle attributes that were
borrowed from Java Gradle Plugin for consistency reasons.
This makes it compatible with JVM tooling that rely on these attributes.

^KT-36943 Verification Pending
2022-12-01 18:57:02 +00:00
Anton Lakotka fd7ceabab6 [Gradle, MPP] Test sources publication as gradle variants
^KT-36943
2022-12-01 18:57:01 +00:00
Anton Lakotka 3a418bfe66 [Gradle, Test] Move mpp-sources-publication test data 2022-12-01 18:57:01 +00:00
Anton Lakotka a093527b8d [Gradle] Copy user-defined attributes to android variants...
when they are grouped by flavor.

In such case a different implementation of SoftwareComponents is used
And originally only KotlinComponents were covered.
2022-12-01 18:57:00 +00:00
Anton Lakotka 8e85e556ce [Gradle] Stop using Usage of UsageContext for maven scoping
Replace it instead with dedicated property [usageScope].

Gradle no longer supports `Usage` and KGP used it only for mapping
dependencies to appropriate maven scopes.
2022-12-01 18:57:00 +00:00
Sergej Jaskiewicz 672be7ecb5 [test] Allow files with same names in tests
Introduce a directive that allows compiling different files with
matching names in tests.
2022-12-01 17:15:55 +00:00
Leonid Startsev ee9d9d7b32 Do not pre-generate writeSelf function for non-JVM platforms
write$Self in K1 is created only on JVM, so we need this check to avoid
creating IR function without original descriptor — it will lead to various
bugs in JS and Native, such as superclass properties missing from output
when super.writeSelf is not found in descriptor.

Fixes #KT-55180
2022-12-01 16:16:38 +00:00
Artem Kobzar 3f4a937ad6 [K/JS] Don't generate TypeScript definitions from ExportModel if the -Xgenerate-dts flag was not provided ^Fixed KT-53940 2022-12-01 15:47:08 +00:00
Artem Kobzar 0f0421ea3d [K/JS] Generating TypeScript definitions for exceptions and rest of the types ^Fixed KT-53940 2022-12-01 15:01:24 +00:00
Vyacheslav Gerasimov 50ad5027fe Build: Fix kotlin-annotation-processing pom dependencies
#KTI-878
2022-12-01 15:50:38 +01:00
Nikita Bobko 5be153cd65 2/2 analysis-api: Initial implementation for contracts
Review: https://jetbrains.team/p/kt/reviews/7652

Put this change into a separate commit because:
1. The change is boring and clutters the diff of the first commit
2. The first commits is already too big
2022-12-01 14:42:49 +01:00
Nikita Bobko b2397f033b 1/2 analysis-api: Initial implementation for contracts
Review: https://jetbrains.team/p/kt/reviews/7652

I need this API for KTIJ-22692
2022-12-01 14:42:49 +01:00
Nikita Bobko 6e637e94ca analysis-api module: drop unused :compiler:frontend dependency
Review: https://jetbrains.team/p/kt/reviews/7652

It's not only unused, this dependency is conceptually wrong because
:compiler:frontend is K1 compiler but :analysis:analysis-api supposed to
be frontend independent
2022-12-01 14:42:49 +01:00
Dmitriy Novozhilov 1281b778fb [Test] Fix broken testdata 2022-12-01 14:47:24 +02:00
Alexander Udalov 3ab2b82878 JVM IR: script is a valid container for local delegated properties
When serializing metadata for local delegated properties, we need to
find a valid container class where to put it, and where kotlin-reflect
will be able to find that metadata at runtime. Taking just the closest
class lexically doesn't work, because in the attached test, it is a
class for a lambda which does not have metadata and thus does not have a
way to store any extra information.

So, in 1663619606 we started to look for the closest "non-synthetic"
class to store this metadata. But apparently it was missed that script
is a valid container class. In the test, this meant that no
non-synthetic container classes were found to store the metadata, so we
falled back to using the closest class anyway (see `?: this` in
`rememberLocalProperty`), which turned out to be the lambda.

After this change, metadata for local delegated property in a lambda
will be stored in the script class, just like it's stored in the file
class in the non-script case.

 #KT-55065 Fixed
2022-12-01 12:55:01 +01:00
Dmitriy Novozhilov fe81ad0bbe [Build] Fix configuration cache issues of miscCompilerTests 2022-12-01 07:29:40 +00:00
Dmitriy Novozhilov 0af16f03c5 [FIR] Fix formatting 2022-12-01 07:29:39 +00:00
Dmitriy Novozhilov 8d2701209e [FIR] Add documentation to AbstractPredicate and FirPredicateBasedProvider 2022-12-01 07:29:39 +00:00
Dmitriy Novozhilov 6864433581 [FIR] Support resolution of meta-annotations before supertypes
Now annotations are resolved with following algorithm:
1. On COMPILER_REQUIRED_ANNOTATIONS we resolve all annotations
     and store results if this is compiler annotation, plugin annotation,
     or annotation with meta-annotation (meta annotations are checked
     recursively with designated resolution if needed)
2. On TYPES stage we resolve all those annotations once again and if
     some annotation changes resolution then we keep type from p.1 and
     report error on this annotation, so user should disambiguate it

Ambiguity may occur because of nested annotations with same name as
  plugin annotations:

```
annotation class SomeAnnotation // (1) plugin annotation

open class Base {
    annotation class SomeAnnotation // (2)
}

class Derived : Base() {
    @SomeAnnotation // <-----------------
    class Inner
}
```
At COMPILER_REQUIRED_ANNOTATIONS annotation call will be resolved to (1)
  because at this stage supertypes are not resolved yet, and we consider
  only importing scopes. At the TYPES stage we will find correct
  annotation from supertype
2022-12-01 07:29:39 +00:00
Dmitriy Novozhilov 6a9b525ca0 [Serialization] Fix dependency on kotlin-reflect 2022-12-01 07:29:38 +00:00
Dmitriy Novozhilov aaf0a1f396 [FIR] Introduce shouldNotBeCalled utility function 2022-12-01 07:29:38 +00:00
Dmitriy Novozhilov 0b4216c096 [FIR] Fix test configuration of FIR plugin prototype 2022-12-01 07:29:38 +00:00
Dmitriy Novozhilov 8436328bb5 [ImportsDumper] Fix path replacements in tests on Windows 2022-12-01 07:29:37 +00:00
Dmitriy Novozhilov 6b343515e1 [Test] Save IR bytecode dumps from BytecodeListingHandler to .ir.txt file instead of _ir.txt
This is needed to keep consistency with other dumps and to allow
  test helper plugin to recognize those dumps
2022-12-01 07:29:37 +00:00
Dmitriy Novozhilov 246dc985a6 [FIR] Rework predicates system
Now predicates are split into LookupPredicate and DeclarationPredicate
  hierarchies. First one allows to perform global search for declarations
  and second one allows to check if some declaration matches the predicate.
Predicates with meta annotations are excluded from LookupPredicates,
  because it's impossible to create index of annotations with meta-annotations,
  because they can be located inside binary dependencies (so to achieve
  this we need to scan the whole classpath).
Also only one predicate with meta-annotations is left in DeclarationPredicate
  hierarchy (AnnotatedWithMeta)

^KT-53874 Fixed
^KT-53590 Fixed
2022-12-01 07:29:37 +00:00
Dmitriy Novozhilov 7a9a71a089 [ImportsDumper] Add missing test runtime dependencies 2022-12-01 07:29:36 +00:00
Dmitriy Novozhilov 2610ad94e0 [SamWithReceiver] Fix test configuration and testdata 2022-12-01 07:29:36 +00:00
Dmitriy Novozhilov ebc879ed1e [AllOpen] Update testdata 2022-12-01 07:29:36 +00:00
Dmitriy Novozhilov dff5799c58 [Test] Don't create separate .fir.txt file in BytecodeListingHandler if not necessary 2022-12-01 07:29:35 +00:00
Dmitriy Novozhilov 700a117476 [Build] Add forgotten compiler plugins tests to aggregate build 2022-12-01 07:29:35 +00:00
Alexander Udalov 25c5ad176c Minor, update instructions for installing protobuf261 + regenerate 2022-12-01 01:37:55 +01:00
Simon Ogorodnik 16476dec61 Owners. Make Evolution Team responsible for LanguageVersionSettings 2022-11-30 21:53:33 +00:00
Artem Daugel-Dauge 30c2c62a1b Properly specify outputs for PodGenTask + expose Podfile location 2022-11-30 21:19:14 +00:00
Pavel Mikhailovskii f96d41e414 KT-4107 Don't generate readResolve for data objects 2022-11-30 21:07:20 +00:00
Marco Pennekamp ea346e3e0e [AA] Rename originalOverriddenSymbol to unwrapFakeOverrides
- `unwrap` signals that fake overrides will be unwrapped until the
  original symbol is recovered.
- Also remove nullability of the returned `KtCallableSymbol`. If the
  given symbol cannot be unwrapped, it is most likely already the
  original symbol.
- Remove the lazy resolve to `STATUS` in `KtFirOverrideInfoProvider`, as
  it's not needed to unwrap fake overrides.
2022-11-30 19:49:14 +00:00
Evgeniy.Zhelenskiy fa4a4e56f3 [Tests] Remove unnecessary usages of OPTIONAL_JVM_INLINE_ANNOTATION
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:42 +00:00
Evgeniy.Zhelenskiy 50310d42e3 [IR] MFVC lateinit variables and properties test
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:42 +00:00
Evgeniy.Zhelenskiy b7f249cdb6 [IR] Fix bugs in MFVC function references support
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:41 +00:00
Evgeniy.Zhelenskiy 86809e898a [IR] Combine value class lowerings
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:41 +00:00
Evgeniy.Zhelenskiy 68fb8aa2a1 [IR] Replace indexes with names for mfvc methods and fields
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:41 +00:00
Evgeniy.Zhelenskiy b692748938 [IR] Always add getter methods to value classes even if not used
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
Evgeniy.Zhelenskiy 3653c86f08 [IR] Rename static replacement of MFVC typed equals to "equals-impl0"
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
Evgeniy.Zhelenskiy 38c80192f9 [IR] Support MFVC-typed properties and interfaces delegates
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:40 +00:00
Evgeniy.Zhelenskiy 4d426fc4cd [IR] Generate not FIR_IDENTICAL box fir value classes tests
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:39 +00:00