Commit Graph

41449 Commits

Author SHA1 Message Date
pyos 2ae06a8d46 FIR DFA: when removing a variable, move type statements about dependents
val c = C("...")
  val d = c
  if (c.x == null) return
  c.x.length // c.x has type String
  d.x.length // d.x -> c.x through d -> c
  c = C(null) // remove alias d -> c
  d.x.length // info from c.x moved to d.x

^KT-54824 Fixed
2022-11-22 15:44:26 +00:00
pyos 3cea2d7243 FIR DFA: assert that type statements are not attached to aliases 2022-11-22 15:44:25 +00:00
pyos ceb1607057 FIR DFA: when breaking aliasing, keep the rest of the group together
var a = ...
  var b = a
  var c = a
  a = ...
  // b and c still aliased
2022-11-22 15:44:25 +00:00
pyos 7c8e9ac316 FIR DFA: remove RealVariableAndType 2022-11-22 15:44:24 +00:00
pyos 33363ba1fc Add more variable aliasing tests 2022-11-22 15:44:23 +00:00
Vladimir Dolzhenko a8bef8ac81 Prevent unsafe publication of not full initialized instance
#KTIJ-22182
2022-11-22 15:24:38 +00:00
Egor Kulikov 067036c162 RawFirBuilder refactoring
Second step for KT-52615
Get rid of PsiHandlingMode
Get rid of source in FirLazyBlock
Refactor lazy creation

Merge-request: KT-MR-7753
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-11-22 14:43:53 +00:00
Nikolay Lunyak c5469d5fb5 [FIR] KT-53988: Report ILLEGAL_SELECTOR for constants as selectors
Merge-request: KT-MR-7756
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>

^KT-53988 Fixed
2022-11-22 10:54:09 +00:00
Anna Kozlova 702d0b4d54 [compiler] missed type parameters in local properties (KTIJ-23583)
even though local variables won't contain type parameters,
let's build fir for them
2022-11-22 10:47:45 +00:00
Anna Kozlova 3fdd0aacd3 [compiler] preserve fir receiver in tree
when selector is invalid expression,
ensure that fir tree still contains receiver as well as selector

KTIJ-23578
2022-11-22 10:46:59 +00:00
Mikhail Glukhikh 1aae9d6456 FIR2IR: generate this reference to non-source class properly
#KT-53983 Fixed
2022-11-22 10:01:16 +00:00
Ivan Kylchik e3f8aa255a Fix StackOverflow in interpreter for case with recursive enum init
#KT-54884 Fixed
2022-11-21 20:03:18 +00:00
Igor Chevdar e16cfd5485 [K/N][IR] Suspend tail call optimization for coroutines
Even if a coroutine class has to be built for a suspend function, we
still can perform tail call optimization for it.
2022-11-21 19:32:41 +00:00
Igor Chevdar b100dfe8be [K/N][IR] Implemented suspend tail call optimization
If for a suspend function all calls to other suspend functions a tail calls,
it is not needed to build the coroutine implementation.
2022-11-21 19:32:40 +00:00
Ilya Kirillov b6481ed891 [FIR] do not use FirValueParameter for function type parameter
As it is a different abstraction, introduced FirFunctionTypeParameter instead

Also, fix syntax checkers for function type parameter

^KT-55035 fixed
2022-11-21 16:17:51 +00:00
Jinseong Jeon f2bc25c71d SLC: fix visibility/static modifer of property in companion 2022-11-21 15:55:13 +01:00
Jinseong Jeon e2901c81ac SLC: populate fields from companion in annotation 2022-11-21 15:55:12 +01:00
Anna Kozlova f937a85fb8 [tests] split by FILE directive to avoid artificial errors
during parsing psi
2022-11-21 13:07:14 +01:00
Roman Efremov 9330018390 Add comment with reference to K2 implementation of opt-in check
^KTIJ-23369 Fixed
2022-11-21 13:09:40 +03:00
Mikhail Glukhikh 1d76bce3dd K2: fix outerClassSymbol behavior for local classes #KT-55018 Fixed 2022-11-21 09:23:54 +00:00
vladislav.grechko 5ec2f1ad92 Get rid of redundant boxing when comparing inline class instances
^KT-33722: Fixed
2022-11-18 23:14:03 +00:00
Artem Kobzar 725a224f74 [K/JS] Make available transitive reexport for ES modules 2022-11-18 16:54:10 +00:00
Zalim Bashorov d2b63c8c31 [Wasm] Use common logic for eqeq and eqeqeq
So, now it generates better code when null literals are passed to `eqeqeq`,
same as for `eqeq`.
2022-11-18 17:30:11 +01:00
Zalim Bashorov 96b02c9b66 [Wasm] Minor: move part of code of eqeqSymbol processing in BuiltInsLowering 2022-11-18 17:30:11 +01:00
Zalim Bashorov 0529ba9a87 [Wasm] Extract common some logic of eqeqSymbol processing in BuiltInsLowering 2022-11-18 17:30:10 +01:00
Zalim Bashorov 919029f34f [Wasm] Add fast path for null in externRefToAny
- Introduce new intrinsics `wasm_ref_cast_null` & `wasm_ref_test_null`.
- Support getting type for immediate from generic argument.
- Remove redundant null check in `tryGetOrSetExternrefBox`.
2022-11-18 17:30:10 +01:00
Egor Kulikov 877e11419e Stub updates for RawFirBuilder
First step for KT-52615
2022-11-18 11:40:09 +01:00
Sergej Jaskiewicz becbc06663 [JS] Re-enable some stepping tests 2022-11-18 10:37:58 +00:00
Mikhail Glukhikh d41c1e7e99 Code cleanup: ExpectedActualResolver 2022-11-17 22:28:04 +00:00
Mikhail Glukhikh 82f1535007 K1: fix IIOBE in expect-actual checker with different type parameter number
#KT-54827 Fixed
2022-11-17 22:28:04 +00:00
Marco Pennekamp c5e5140c08 [Analysis API] Fix exceptions around type parameters being treated as callables
- `toResolvedCallableSymbol`: cast defensively because
  the resolved symbol might not be a callable symbol.
- `toKtCallInfo`: Check that the resolved symbol is actually callable.

^KTIJ-23003 fixed
2022-11-17 18:58:38 +00:00
vladislav.grechko 36b8ba8df3 Improve support of custom equals in inline classes
- Ensure that typed equals parameter's type is a star projection of
  corresponding inline class

- Make possible to declare typed equals that returns 'Nothing'

- Forbid type parameters in typed equals operator declaration

^KT-54909 fixed
^KT-54910 fixed
2022-11-17 15:35:14 +01:00
Artem Vasilev 02484baf07 [FIR] Set Java constructor source to Java class's when it's implicit
When there are no declared constructors in Java class, make
javaConstructor's source element point to the class declaration,
making it possible to navigate from constructor's invocation there.

^KTIJ-22360 Fixed
2022-11-17 13:18:30 +00:00
Dmitrii Gridin 5ab07c2c00 [FIR] ConversionUtils: add todo
^KT-54417
^KT-55002
2022-11-17 09:50:19 +00:00
Dmitrii Gridin cdd311d1da Revert "[FIR] simplify receiver parameter creation"
This reverts commit ad60b345

^KT-54417
2022-11-17 09:50:18 +00:00
Dmitrii Gridin 032026278c fix compilation and testData after rebase
^KT-54417
2022-11-17 09:50:17 +00:00
Dmitrii Gridin d0a420fad9 [FIR] FirCallCompleter: simplify code
^KT-54417
2022-11-17 09:50:17 +00:00
Dmitrii Gridin 86422d0944 [FIR] FirReceiverParameter: rename type to typeRef
^KT-54417
2022-11-17 09:50:17 +00:00
Dmitrii Gridin 40c64c672d [FIR] FirRenderer: render receiver annotation
^KT-54417
2022-11-17 09:50:16 +00:00
Dmitrii Gridin 649bf92d98 [FIR] simplify receiver parameter creation
^KT-54417
2022-11-17 09:50:16 +00:00
Dmitrii Gridin ef5a3303b2 [FIR] FirBasedSymbol: add internal annotation for internal things
^KT-54417
2022-11-17 09:50:15 +00:00
Dmitrii Gridin d6fbcef85a [FIR IR] add more strict type for explicit receiver
^KT-54417
2022-11-17 09:50:15 +00:00
Dmitrii Gridin 3cd85a4622 [FIR] drop redundant receiver copy
^KT-54417
2022-11-17 09:50:15 +00:00
Dmitrii Gridin f67030f035 [FIR IR] DumpIrTree: drop irrelevant change
^KT-54417
2022-11-17 09:50:14 +00:00
Dmitrii Gridin b40d329751 [FIR] FirAnnotationBuilder: drop redundant buildAnnotationCopy
^KT-54417
2022-11-17 09:50:13 +00:00
Dmitrii Gridin 22cfea5058 [FIR] introduce KtFakeSourceElementKind.ReceiverFromType
^KT-54417
2022-11-17 09:50:13 +00:00
Dmitrii Gridin 8cd404c84c [FIR IR] FirMetadataSerializer: replace some buildReceiverParameter with buildReceiverParameterCopy
^KT-54417
2022-11-17 09:50:13 +00:00
Dmitrii Gridin 6b41d8c1e4 [AA] FirLoadCompiledKotlinGenerated: update testData
^KT-54417
2022-11-17 09:50:11 +00:00
Dmitrii Gridin 33281770c7 [FIR IR] support FirReceiverParameter
^KT-54417
2022-11-17 09:50:11 +00:00
Dmitrii Gridin 07aec4de8f [FIR] migrate OptIn checker to receiver parameter
^KT-54417
2022-11-17 09:50:11 +00:00