Commit Graph

105987 Commits

Author SHA1 Message Date
Ivan Kochurkin 64db96eda3 [K1, K2] Use safe names when accessing to type parameters
^KT-57529 Fixed
2023-11-09 12:21:43 +01:00
Ivan Kochurkin 3188f01720 [FIR] Handle ConeIntersectionType in createSimpleType
^KT-62819 Fixed
2023-11-09 11:19:07 +00:00
Dmitriy Novozhilov 11586975e8 [FIR2IR] Add KDoc to Fir2IrConfiguration.linkViaSignatures flag 2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 687f5fc20d [Native] Add fast check that stdlib is present in klib dependencies
Previous changes uncovered a problem with lacking of stdlib in
  dependencies, which was quite hard to debug and determine.
  So this check is supposed to discover similar issues in the future
  much more easily.
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov b4d29aa583 [Native] Enable linkViaSignatures for K2/Native compiler
Setting `linkViaSignatures = false` leads to the situation when fir2ir
  provides no guarantees about how SymbolTable is filled, so if some
  backend relies on symbol table content (JS and Native does) then
  it's required to set this flag to `true`

The issue was uncovered by previous commits because previously fir2ir
  created symbols with signatures for some declarations even with
  disabled flag, which was fixed by those commits
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 740dcfe3c5 [FIR2IR] Manage enum entry symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 10ad526936 [FIR2IR] Manage typealias symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov d4b0627640 [FIR2IR] Manage class symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 7652752e3f [FIR2IR] Pass proper typeOrigin to implicitCastOrExpression
Without it the following test is failing:
- `org.jetbrains.kotlin.test.runners.ir.FirPsiJvmIrTextTestGenerated.Types#testGenericPropertyReferenceType`
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 78259e3ee0 [FIR2IR] Manage type parameter symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
 for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 36c0ed3c9e [FIR2IR] Get rid of last usage of symbolTable in Fir2IrCallableDeclarationsGenerator 2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov aab5664c5b [FIR2IR] Manage script symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov cd0baef087 [FIR2IR] Manage field symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov aadc9ce6d5 [FIR2IR] Manage property symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov fe66f3a384 [FIR2IR] Manage constructor symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)

There was an exception from FIR2IR that was fixed with this change,
 so fir2ir test SuperClass started to pass along with IrActualizer,
 which reported some new errors
2023-11-09 10:43:31 +00:00
Dmitriy Novozhilov 3c0f153de4 [FIR2IR] Manage function symbols in declaration storage instead of declaration generator
This is needed to be able to implement creation of unbound symbols
  for references of corresponding declarations (KT-62856)

There was an exception from FIR2IR that was fixed with this change,
  so fir2ir test expectDeclarationWithWeakIncompatibilities started to
  pass along with IrActualizer, which reported some new errors
2023-11-09 10:43:31 +00:00
Alexander Udalov 953f6ba6b6 K2: keep FlexibleNullability on enhanced type parameter types
Types based on type parameters which have both hasEnhancedNullability
and hasFlexibleNullability were incorrectly converted to IR: only
`@EnhancedNullability` annotation was added to the IR type. This means
that the nullability of the type started to matter, which is incorrect
because the type is supposed to be flexible.

This backfired in the IR fake override builder mode, where nullability
of methods inherited from both Kotlin maps and Java maps clashed, which
resulted in the exception from FakeOverrideRebuilder.

If the type is both flexible and enhanced, we're now adding
`@FlexibleNullability` to the IR type. Note that `@EnhancedNullability`
is not needed because it only affects primitive types which need to be
handled as wrapper types on JVM, but `@FlexibleNullability` already has
that effect.

IR still slightly differs from K1 for collection subclasses, which can
be seen for example in the changed IR text tests. This is to be
investigated later.

The change in tests is needed because the `kt48495*.kt` tests are now
passing on K2 in the IR fake override builder mode, while failing on the
vanilla K2.

This is related to KT-61370 but does not entirely fix it, although
curiously it fixes all remaining tests which were muted because of it.
2023-11-09 09:13:28 +00:00
Anton Lakotka fe87f41c39 [Gradle] Correct valueSourceProviderCompat
* rename it to valueSourceWithExecProviderCompat
* After Gradle 7.5 use provider.of

^KT-63044
2023-11-09 08:09:56 +00:00
Dmitrii Gridin ba7c341338 [LL FIR] annotation calculator for scripts should process only script inself
We shouldn't calculate annotations inside unrelated declarations without lock

^KT-63042
^KT-63282
2023-11-08 23:22:19 +00:00
Dmitrii Gridin 4f2750a189 [LL FIR] add missed annotation arguments resolution for script generated declarations
^KT-63282 Fixed
2023-11-08 23:22:19 +00:00
Dmitrii Gridin dc158d2b29 [LL FIR] add lazy resolve test on propagated type in $$result
^KT-63282
2023-11-08 23:22:19 +00:00
Vladimir Sukharev dd5f6a7619 Use IntelliJ inspection "PublicApiImplicitType" 2023-11-08 21:05:52 +00:00
Igor Yakovlev 38695ff14c Fix Wasm gradle plugin DSL invalid behaviour
Fixed #KT-63315
2023-11-08 18:48:33 +01:00
Ilya Kirillov d2b9b487c7 [Analysis API] add test for resolution into declarations with the kotlin. package
^KT-63223
2023-11-08 17:32:49 +00:00
Ilya Kirillov 063d73fa73 [Analysis] migrate analysis modules to use cliArgument helper instead of hardcoded CLI argument names
^KT-63294
2023-11-08 17:32:48 +00:00
Ilya Kirillov 6f097dc8f6 Introduce utility function for specifying compiler argument names
^KT-63294
2023-11-08 17:32:48 +00:00
Ilya Kirillov c54d83dcad [Analysis API] fix resolution to declarations inside kotlin*. packages
`kotlin*.` packages should be always allowed.
`kotlin.` packages should be allowed if `AnalysisFlags.allowKotlinPackage` is `true`

^KT-63223 fixed
2023-11-08 17:32:48 +00:00
Aleksei.Glushko d22218e4e4 [K/N] Non-worker work source in ParalleProcessor
To be used as thread-local mark queue in concurrent mark.


Merge-request: KT-MR-12723
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-11-08 17:20:15 +00:00
Yahor Berdnikau 224a46e438 [Gradle] Decrease in tests Gradle daemons idle timeout
Our Gradle integration tests could launch multiple Gradle daemons
with different versions and using different JDK versions. They are
stick around until the whole test finishes using necessary memory.

Especially this is a problem on our CI where OOM killer often tries
to kill actually needed daemon.

This commit decreases spawned Gradle Daemon idle timeout, so they
shut down itself much earlier than default timeout of 3 hours.
2023-11-08 17:10:26 +00:00
Jinseong Jeon 4110a9971a AA: fix KtTypeProvider#getReceiverTypeForDoubleColonExpression
K1 version has used a wrong expression to retrieve the slice.
K2 version mishandled property access as a receiver.

^KT-63195 fixed
2023-11-08 16:18:21 +00:00
Evgenii Mazhukin 26bac388e8 [IC] Drop useK2 from compiler/incremental-compilation-impl tests
Merge-request: KT-MR-12879
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-08 15:49:37 +00:00
Kirill Rakhman d54068b8ab [FIR] Report NONE_APPLICABLE on callable references with multiple failed candidates 2023-11-08 15:45:48 +00:00
Kirill Rakhman 6d2ab92d91 [FIR] Set positioning strategy for UNRESOLVED_REFERENCE_WRONG_RECEIVER 2023-11-08 15:45:48 +00:00
Kirill Rakhman 789f886d3c [FIR] Implement ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE diagnostic
#KT-59401 Fixed
2023-11-08 15:45:48 +00:00
Kirill Rakhman d91000e39c [FIR] Report INAPPLICABLE_CANDIDATE or more specific diagnostic for callable references
... instead of just UNRESOLVED_REFERENCE when something went wrong
during resolution.

#KT-59401 related
2023-11-08 15:45:48 +00:00
Kirill Rakhman 6b7eeec181 [FIR] Fix candidate success check by checking if no diagnostic is unsuccessful
Checking the current applicability isn't enough because in the presence
of multiple diagnostics, the lowest applicability can be successful but
a higher one isn't.

#KT-63147 Fixed
2023-11-08 15:45:48 +00:00
Brian Norman 0d36462c58 [Parcelize] Align checker and generator on valid Parcelize classes
A previous fix to the generator made the generator and checker
validation of classes which could be parcelized different. The checker
would report error in cases where the generator would not generate
anything. Align these checks, with improved code sharing, so errors are
not reported on classes which will not have parcelize components
generated.

^KT-63086 Fixed
2023-11-08 14:35:28 +00:00
marat.akhin d5fe86559d [Tests] Add test for KT-59493
This is to record the red->green change in behavior between K1 and K2,
when K2 correctly handles resolution/inference of an extension function
with definitely non-nullable type.
2023-11-08 14:05:56 +00:00
Brian Norman f8ee8adfde [Parcelize] Fully expand type aliases when checking for RawValue
^KT-61432 Fixed
2023-11-08 12:48:36 +00:00
Brian Norman ad4d075125 [FIR] Do not allow vararg function to be used as synthetic setter
^KT-63172 Fixed
2023-11-08 12:22:29 +00:00
Dmitrii Gridin dbaf4a2d5e [FIR] resolve type annotations on implicit return type of local property
This still doesn't work for unresolved delegate (see analysis/low-level-api-fir/testData/getOrBuildFir/wholeDeclaration/localDelegatedPropertyWithPropagatedType.out_of_src_roots.txt)

^KT-63042
2023-11-08 12:20:40 +00:00
Dmitrii Gridin 143f86cc1c [LL FIR] add test on implicit type for local property
^KT-63042
2023-11-08 12:20:40 +00:00
Anton Lakotka 5161b3b7d8 [Gradle] Replace TaskProvider.flatMap with map { it.get() }
flatMap doesn't support implicit task dependencies due to bug:
https://github.com/gradle/gradle/issues/25645

However `map { it.get() }` works.

^KT-63011 Verification Pending
2023-11-08 11:50:23 +00:00
Anton Lakotka 5aa8ecca9b [Gradle] Test that framework configurations task dependencies
^KT-63011
2023-11-08 11:50:23 +00:00
Abduqodiri Qurbonzoda 999b0f7099 Avoid allocating large buffers in File.writeText #KT-51058
Also fixes File.appendText and Path.write/appendText.


Merge-request: KT-MR-12804
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-11-08 11:18:56 +00:00
Ivan Kochurkin 54ab3d39db [FIR] Fix crash on incorrect call on ILT
^KT-62306 Fixed
2023-11-08 10:27:44 +00:00
Kirill Rakhman c5da2b7433 [FIR] Rename FirElementSerializer.containingDeclaration to currentDeclaration for clarity 2023-11-08 10:26:34 +00:00
Kirill Rakhman 7da271bab8 [FIR] Serialize context receivers using the correct local serializer
This leads to type ref referring to generic type variables being
serialized correctly.
When the type variable is declared on the member itself, it's written to
typeParameterName,
otherwise it's written to typeParameter. This is required for
deserialization to work correctly.

#KT-63227 Fixed
2023-11-08 10:26:34 +00:00
Alexander Shabalin fe94876d9a [K/N] Fix handling custom llvm and libffi distributions ^KT-63220 2023-11-08 09:24:20 +00:00
Kirill Rakhman eba1fdec1d [Tests] Check for duplicate file names in FIR diagnostic tests with IR
The relative path of a test file is just its name, even if it's in a
module.
Diagnostics in IR are mapped to the file path and so it's reported on
all files with the same path, i.e. name.
This doesn't happen in production code because no two files can have
the same path.

The proper fix would be to prefix the test files' paths with the module
name.
Unfortunately, this breaks a bunch of test runners that rely on the
current behavior.
Especially, some JS runners turned out to be hard to fix.
The linked YouTrack issue contains a WIP, incomplete patch of fixing
some runners.

#KT-61592 Fixed
#KT-63252
2023-11-08 08:25:19 +00:00