Commit Graph

44392 Commits

Author SHA1 Message Date
Ivan Kylchik 8e42ccaccb [IR] Drop FoldConstantLowering and StringTrimLowering 2023-07-10 13:19:51 +00:00
Ivan Kylchik ad6332112e [IR] Support const optimizations for Native backend 2023-07-10 13:19:51 +00:00
Pavel Mikhailovskii 6e6a4d6411 KT-59836 [SLC] Copy type parameters from the parent interface to DefaultImpls methods 2023-07-10 13:11:21 +00:00
Nikolay Lunyak d13e60aaec [FIR] Prevent loosing errors for synthetic outer calls
The error occurs when completing the
call for the outer synthetic call
`ACCEPT_SPECIFIC_TYPE`. The error
is saved into the CS of this outer
candidate, which leads to its
callable reference to be an error
reference, but since such calls are
not parts of the FIR tree, we never
collect such errors.

^Fixed KT-59233
2023-07-10 10:26:43 +00:00
Nikolay Lunyak 79fce56c95 [FIR] Add a test for KT-59233 2023-07-10 10:26:43 +00:00
Nikolay Lunyak d4c6e55e0a [FIR] Require equivalent candidates to have the same parameters count 2023-07-10 09:43:22 +00:00
Nikolay Lunyak fe783d7121 [FIR] Require equivalent candidates to have the same parameters order
NB: In general, it's unclear what to do in cases
like the following one, even when sometimes
we could, indeed, prefer something:

```
fun foo(a: Int, b: String, c: Boolean)
fun foo(b: String, c: Boolean, a: Int)

foo(c = false, b = "", a = 0)
```

^KT-55933 Fixed
2023-07-10 09:43:22 +00:00
Nikolay Lunyak 4f0563dee1 [FIR] Add a test for KT-55933 2023-07-10 09:43:22 +00:00
Nikolay Lunyak da60be06a0 [FIR] Add references to TODOs in checkers 2023-07-10 09:28:55 +00:00
Nikolay Lunyak 8c5b2ae85b [FIR] Fix modifying CheckerContext inside checkers
`InlineFunctionBodyContext` was not moved
outside the class to preserve as much
git blame info as possible.

^KT-56460 Fixed
2023-07-10 09:28:55 +00:00
Nikolay Lunyak ed2f0c295b [FIR] Remove the TODO from FirExplicitBackingFieldForbiddenChecker
Looks obsolete, nothing seems to fail.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak b46d4e5399 [FIR] Check classes for EXPECTED_PRIVATE_DECLARATION 2023-07-10 09:28:54 +00:00
Nikolay Lunyak e7f1da3619 [FIR] Check actuals in FirOverloadsChecker 2023-07-10 09:28:54 +00:00
Nikolay Lunyak a9207a8396 [FIR] Remove the TODO in FirJvmAnnotationHelper.kt
This code should not be reachable when not
in JVM. `jvmDefaultModeState` is only
accessed from the JVM checkers.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak 8541143d6f [FIR] Fix the TODO in FirConflictsHelpers
According to
https://github.com/Kotlin/KEEP/blob/master/proposals/enhancing-main-convention.md#rules-and-semantics,
only main function without args may avoid
`CONFLICTING_OVERLOADS`, but since the
jps/jps-plugin/testData/incremental/withJava/other/mainRedeclaration
test dates back to 2015, this is not the
current behavior.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak 3014c7b353 [FIR] Check isMember via the dispatch receiver 2023-07-10 09:28:54 +00:00
Nikolay Lunyak 553f400c25 [FIR] Remove the TODO from ConeTypeCompatibilityChecker
Ignore, because `@JvmDefault` is deprecated
and we don’t even have tests for it, and
the new
``@JvmDefaultWith[out]Compatibility` only
allow classes as their targets
2023-07-10 09:28:54 +00:00
Nikolay Lunyak c2c073ab2d [FIR] Remove the TODO from ConeTypeCompatibilityChecker
The issue is closed as fixed
2023-07-10 09:28:54 +00:00
Nikolay Lunyak 0e70e9e8d9 [FIR] Remove the TODO from FirReturnsImpliesAnalyzer
Declined, ignore.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak 884cd6c754 [FIR] Move FirReturnsImpliesAnalyzer to the extended checkers 2023-07-10 09:28:54 +00:00
Nikolay Lunyak db720d375d [FIR] Remove the TODO from FirModifierChecker.kt
Pasha said we can delete it.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak b8377d49a8 [FIR] Remove unused code from FirExpectActualDeclarationChecker
Dima said this code is not needed.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak 62d0060f0d [FIR] Remove the TODO in FirDelegatedPropertyChecker
This TODO is unclear, and since we don't
really care what should happen to the
unreachable code, it can be ignored.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak be8d9ba262 [FIR] Remove the TODO in FirDelegatedPropertyChecker
It looks like in `differentDelegatedExpressions.fir.kt`
there're no diagnostics on the delegates
already, so this TODO is unclear.
2023-07-10 09:28:54 +00:00
Nikolay Lunyak 24b1fb2ccf [FIR] Create tickets for some of the TODOs 2023-07-10 09:28:54 +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
Igor Yakovlev b5eafb9eb7 [Wasm] WasmExport implementation 2023-07-07 20:45:51 +00:00
Sergei Kharitontcev-Beglov 34c6afec5e [Wasm] A name cache to distinguish same named declarations in DCE dump 2023-07-07 17:42:00 +00:00
Sergei Kharitontcev-Beglov bc0afc36a2 [Wasm] Renovated Ir declarations dump by adding a type entry 2023-07-07 17:42:00 +00:00
Sergei Kharitontcev-Beglov 3b52b452a3 [Wasm] Escaped quotes and added export in DCE in IR dumps 2023-07-07 17:42:00 +00:00
Igor Yakovlev 750653e4b3 [Wasm] Add kotlin wasm wasi mode compiler flag 2023-07-07 15:23:18 +00:00
Artem Kobzar 7c7aa98875 [K/JS] Throw error when a module contains file with the same name and package (ignoring case) 2023-07-07 13:50:04 +00:00
Dmitrii Gridin 6867dffff1 [LL FIR] rewrite on-air resolve
Now we will resolve declarations only ones and to the
minimal required phase to get a fully resolved element
depends on an insert position, because not all elements
require body resolution

A side change: `getOnAirGetTowerContextProvider` now
won't do rebind to the original declaration. In the future,
this part will be rewritten to avoid on-air resolution,
so it is not a problem

^KT-59685 Fixed
2023-07-07 11:42:22 +00:00
Brian Norman 61acd2b6f5 [FIR] Do not allow context receivers on value classes
#KT-59413 Fixed
2023-07-07 11:41:59 +00:00
Brian Norman b74ff19930 [FIR] Improve synthetic function condition in annotation class checker 2023-07-07 11:41:59 +00:00
Dmitriy Novozhilov e7a10057f2 [Test] Use special test facade for IR actualization and IR plugins in all codegen configurations
Previously application of plugins was part of fir2ir conversion and
  ir actualization was the responsibility of each specific IR backend
  facade. Now (after moving IR extensions after IR actualization) those
  actions are extracted into separate facade for two purposes:
1. Avoid code duplication in backend facades
2. Step with this facade goes exactly after fir2ir conversion before
   irHandlersStep, which allows IR handlers to observe IR which was
   actualized and modified by extensions, which is quite useful

^KT-56173
2023-07-07 11:26:15 +00:00
Dmitriy Novozhilov fd87d722c1 [FIR2IR] Make ExternalPackageParentPatcher a lowering
This is needed for two reasons:
1. Consistency
2. It should run after compiler plugins, which are now runs after fir2ir
   is finished for all modules

^KT-56173
2023-07-07 11:26:15 +00:00
Dmitriy Novozhilov 8e73d5a54a [FIR] Run irGenerationExtensions after IR actualization
^KT-56173 Fixed
2023-07-07 11:26:15 +00:00
Pavel Mikhailovskii 083f54aceb [KAPT4] Create basic infrastructure for KAPT4 2023-07-07 11:09:16 +00:00
Dmitriy Novozhilov fc57f48c8f [FIR] Union CFG edges from postponed lambdas only if outer call was analyzed independently
Before this change nodes unification was called if outer call was
  completed in the FULL mode, but it may happen even if this call is
  actually a part of some other outer call
2023-07-07 06:45:20 +00:00
Artem Kobzar cf949e8760 [K/JS] Support KClass<*>.createInstance reflection method ^KT-58684 Fixed 2023-07-06 18:18:14 +00:00
Mikhail Glukhikh ca0b061675 Add forgotten issue reference for PrioritizedEnumEntries 2023-07-06 17:49:15 +00:00
Mikhail Glukhikh ff490fb633 FIR2IR: add more detailed exception message for KT-59766 2023-07-06 17:49:15 +00:00
Mikhail Glukhikh 15b070b494 K2: don't resolve callable reference to enum entries #KT-59611 Fixed 2023-07-06 15:06:31 +00:00
Alexander Korepanov 2cb28b6be1 [JS IR] Add an explicit toString() call for concatenating Char values
^KT-59718 Fixed
2023-07-06 14:40:06 +00:00
Dmitriy Dolovov 8aacdb471b [K/N] Fix: Ignore bridge functions in FunctionReferenceLowering
^KT-59858
2023-07-06 12:39:46 +00:00
Dmitriy Novozhilov 037572ee9f [FIR] Create FirExtensionSyntheticFunctionInterfaceProvider only once for all sessions
This is needed to avoid duplication of symbols for the same classIds

^KT-58539 Fixed
2023-07-06 11:00:38 +00:00
Dmitriy Novozhilov 32891edc3e [Test] Register DisableLazyResolveChecksAfterAnalysisChecker as first failures suppressor
It's important to filter out failures from lazy resolve before calling other
  suppressors like BlackBoxCodegenSuppressor. Otherwise other suppressors
  can filter out every failure from test and keep it as ignored even if
  the only problem in lazy resolve contracts, which disables with special directive
2023-07-06 11:00:38 +00:00
Ivan Kylchik 31e75cc603 [JS_IR] Forbid to inline constants during const lowering 2023-07-06 11:00:14 +00:00
Ivan Kylchik d3d28783c5 [IR] Support const optimizations for JS backend 2023-07-06 11:00:14 +00:00