Commit Graph

45969 Commits

Author SHA1 Message Date
Mikhail Glukhikh d42ae35624 K2: support DELEGATION member kind for properties #KT-62581 Fixed 2023-10-25 20:19:39 +00:00
Ivan Kylchik e827f260e7 [IR] Simplify IrProperty?.isConst check in interpreter 2023-10-25 16:43:25 +00:00
Ivan Kylchik a97c0bab0b [IR] Simplify access to IrProperty from IrCall and IrField in interpreter 2023-10-25 16:43:25 +00:00
Vladimir Sukharev 604c8edd1c [K/N] Fix kt53261_* tests to be dummy in debug mode
^KT-62157 Fixed


Merge-request: KT-MR-12720
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-25 16:07:01 +00:00
Ilya Goncharov 065733e87c [FIR] Add UNINITIALIZED_ENUM_ENTRY on access qualifier of local enum
^KT-59967 fixed
2023-10-25 15:36:11 +00:00
Jinseong Jeon 1ccb085e68 SLC: use fully expanded type when computing nullability
^KT-62757 fixed
2023-10-25 14:59:50 +00:00
Ilya Goncharov 573bc34b56 [JS] Invoke processing separately for suspend and non-suspend function
^KT-62771 fixed
2023-10-25 13:28:58 +00:00
Alejandro Serrano Mena f227447837 [K2] Disallow named functions as expressions
^KT-62573 Fixed
^KT-59945 Fixed
2023-10-25 13:24:30 +00:00
Dmitriy Novozhilov fb8bf19091 [IR] Rename IrSymbolInternals to UnsafeDuringIrConstructionAPI
The new name more precisely describes the meaning of this opt-int
2023-10-25 11:32:46 +00:00
Marco Pennekamp 38ebe60e9f [FIR] Refactoring: Move set utility functions to setUtils.kt 2023-10-25 11:04:36 +00:00
Marco Pennekamp efe587691b [FIR] Type "top-level classifier names in package" as Name
- This is more consistent with "top-level callable names in package" and
  simplifies the set construction quite a bit, as we can avoid a lot of
  `asString` conversions.
2023-10-25 11:04:36 +00:00
Anna Kozlova e79bc5bb59 [AA] KtExpressionInfoProvider.getMissingCases: fix no subject case
return missing else branch (even if it's present, see kdoc)

^ KT-62875 fixed
2023-10-25 09:41:38 +00:00
Dmitrii Gridin 3941b05909 [FIR] do not transform annotations on delegated property accessors during implicit type phase
^KT-62874 Fixed
2023-10-25 08:59:15 +00:00
Dmitrii Gridin 1b636bf450 [FIR] add tests on annotations for delegated getter during implicit type phase
^KT-62874
2023-10-25 08:59:15 +00:00
Ivan Kochurkin 1827df82c4 Removed useless as casts from compiler code
It allows compiling code with K2 and enabled `-Werror`
2023-10-24 20:59:56 +00:00
Ivan Kochurkin d50c6f1b6d [FIR] Fix missing USELESS_CAST
`FirUselessTypeOperationCallChecker` always checks exact types matching for `as` operator

Simplify code of cast checker and utils

^KT-56629 Fixed
^KT-56615 Fixed
^KT-59820 Fixed
2023-10-24 20:59:56 +00:00
Dmitrii Gridin 2f8026f335 [LL FIR] add missed diagnostic tests for scripts
^KT-62840
^KT-62841
^KT-62861
2023-10-24 19:32:54 +00:00
Mikhail Glukhikh 5bd9b282a0 K2/JS: fix JS_NAME_CLASH positioning as source was changed for callable copies 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 3cb9396b20 K2: prefer derived class sources for callable copies (e.g. fake overrides) 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 4b2a122f80 FIR2IR: make delegate field/accessors sources closer to PSI2IR
#KT-59864 Fixed
2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 47fec1a113 K2: use similar sources for if branches (PSI/LT)
Related to KT-59584
2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 21b4ce050c K2: add source range test to ensure #KT-59584 Fixed 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 920b0bfe63 FIR2IR: use SYNTHETIC_OFFSET for data class generated members 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh a9894b1842 K2: use derived class sources for callable copies if base callables have no sources
Related to KT-60155
2023-10-24 17:08:40 +00:00
Vladimir Sukharev 8395018de8 [FIR] Fix disappeared INVALID_CHARACTERS_NATIVE_ERROR
https://youtrack.jetbrains.com/issue/KT-60003/K2-Disappeared-INVALIDCHARACTERSNATIVEERROR

^KT-60003 Fixed

Merge-request: KT-MR-12686
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-24 16:28:30 +00:00
Dmitriy Novozhilov 07c4cd231c [FIR2IR] Lazily load all classes in FIR2IR builtins which may appear in sources
If some of builtin classes is declared in sources, trying to load it in
  IrBuiltInsOverFir before fir2ir pass which generates IR for source
  declarations will lead to creating lazy class instead of normal one

Without this change the following tests are failing:
- `FirLightTreeBlackBoxInlineCodegenWithBytecodeInlinerTestGenerated.Signature`
  - `testByteIteratorWithWhileLoop`
  - `testByteIteratorWithForLoop`
2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov 81821d4cd4 [FIR2IR] OptIn to using IrClass.declarations in all appropriate places 2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov 38a7f2bc07 [IR] Mark utilities, which use IrDeclarationContainer.declarations with @IrSymbolInternals
Only those utilities are marked because only them are accessible in fir2ir.
  And in other modules it's allowed to access .declarations from anywhere
2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov 78a705a1bc [Build] Opt in to IrSymbolInternals for some backend-specific modules 2023-10-24 15:35:05 +00:00
Dmitriy Novozhilov c8b7dbd352 [IR] Add optIn to IrDeclarationContainer.declarations
Accessing list of declaration may trigger lazy declaration list computation for lazy class,
   which requires computation of fake-overrides for this class. So it's unsafe to access it
   before IR for all sources is built (because fake-overrides of lazy classes may depend on
   declaration of source classes, e.g. for java source classes)

So this OptIn is needed to carefully handle all cases of .declarations access in FIR2IR
2023-10-24 15:35:05 +00:00
Kirill Rakhman 56f53fbd0b [FIR] Make ClassId not null in enum call mapped from java 2023-10-24 13:27:02 +00:00
Evgeniy.Zhelenskiy f4d18da6a0 [FIR] Introduce OPERATOR_CALL_ON_CONSTRUCTOR diagnostic
#KT-59943
2023-10-24 12:24:52 +00:00
Dmitriy Novozhilov 0325ffaa01 [FIR] Properly handle nested annotations on compiler-required annotation phase
There was a case when we visited the same declaration multiple times
  because of forward-referencing and visiting with designation
So because of this there were two changes required:
- remove assertion about visiting the same declaration twice (it's fine
  since we don't actually resolve annotations twice)
- not skipping resolution of class children if annotations on this class
  are already resolved

^KT-61388 Fixed
KT-62854
2023-10-24 11:44:21 +00:00
Svyatoslav Kuzmich aeeb5d5c48 [Wasm] Disallow dynamic type in K2 (KT-56849) 2023-10-24 10:54:58 +00:00
Ivan Kochurkin f37f1e6d91 [FIR] Add a comment that explains why FirErrorTypeRefImpl is written manually 2023-10-24 10:53:33 +00:00
Ivan Kochurkin bb937a8a21 [FIR] Initialize annotations in FirErrorTypeRef
^KT-62447 Fixed
^KT-62628 Fixed
2023-10-24 10:53:33 +00:00
Dmitrii Gridin ec3cfdefcb [LL FIR] add missing file node to control flow graph
The file

^KT-62834 Fixed
2023-10-24 10:30:55 +00:00
Dmitrii Gridin a1ee07603a [FIR] add cfg dump to script test
^KT-62834
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 2eb761adae [LL FIR] generate resolution tests over codegen/box testData
Such testData can contain contract violations and other resolution
problems, so we should check them as well

^KT-62776
^KT-62832
^KT-62834
^KT-62836
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 052b9f01af [tests] TestRunner: wrap exceptions from preAnalysisHandlers
Some exceptions (like contract violations) can be thrown from preAnalysisHandlers
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 5a786e25c2 [codegen] testData: move WITH_STDLIB to global scope 2023-10-24 10:30:55 +00:00
Dmitrii Gridin 09a1df9ee5 [codegen] testData: add missing directory structure for Java classes 2023-10-24 10:30:55 +00:00
Sergej Jaskiewicz 9eacdb3314 [FIR generator] Print builder property name in generated classes' KDocs
Just like we do when generating the IR tree
2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz fa20e401f8 [IR generator] Rename kdoc -> kDoc property in FieldConfig 2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz 7e7f4811bd [FIR/IR generator] Add kDoc property to AbstractElement & AbstractField 2023-10-24 10:29:43 +00:00
Xin Wang 51325ba630 [IR] Implement getContextReceiverParameters for IrBasedPropertyDescriptor
Fixes: KT-59590
2023-10-24 10:07:08 +00:00
Kirill Rakhman 65ff684589 [FIR] Don't discriminate generics in conflict resolution for callable references
#KT-59430 Fixed
2023-10-24 07:27:07 +00:00
Alexander Udalov b5ba9ee671 IR: refactor resolveFakeOverride call sites
Split it to 4 functions for clarity: resolveFakeOverride,
resolveFakeOverrideOrFail, resolveFakeOverrideMaybeAbstract,
resolveFakeOverrideMaybeAbstractOrFail. Remove/inline duplicated
utilities and remove unused parameters.
2023-10-23 23:38:47 +00:00
Svyatoslav Kuzmich 2694326ef8 [Wasm] Add EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE K2 diagnostic
Prohibit extending non-external types with external types (same as K1)

Issue KT-56849
2023-10-23 17:31:04 +00:00
Brian Norman 29807af9cb [FIR] Extract symbol from candidates for function contract DFA
^KT-61055 Fixed
2023-10-23 16:29:47 +00:00