Commit Graph

38284 Commits

Author SHA1 Message Date
Ilya Goncharov cac286c915 [JS IR] Access with exported properties by its name, not accessor
[JS IR] Export properties to ts as getter/setter, not fields

[JS IR] Fix typescript tests



Merge-request: KT-MR-5074
2021-11-26 09:18:12 +00:00
Dmitriy Novozhilov 2b84e8e68f [FIR] Pass proper containing classes from context to type resolution for local classes 2021-11-26 11:26:24 +03:00
Dmitriy Novozhilov 330574cab6 [FIR] Properly support smartcasts on stable when subjects in when conditions
^KT-49860 Fixed
2021-11-26 11:26:21 +03:00
Dmitriy Novozhilov 20425fb458 [FIR] Add wrapped expressions for when subject expression with smartcast 2021-11-26 11:26:19 +03:00
Dmitriy Novozhilov 8707be51c9 [FIR] Report errors about invisible types from type resolution 2021-11-26 11:26:17 +03:00
Dmitriy Novozhilov f2c319c4ae [FIR] Add ability to safe proper ConeKotlinType in FirErrorTypeRef
This is needed for cases when some type ref is resolved to proper type
  but has some diagnostic (e.g. this type is invisible)
2021-11-26 11:26:16 +03:00
Artem Kobzar 08b0e17d47 feat(polyfills): use stdlib for js polyfills. 2021-11-26 08:14:34 +00:00
Mikhail Glukhikh 4a8f00bc7c FIR2IR: support reading of isNewPlaceForBodyGeneration in lazy class 2021-11-26 09:18:11 +03:00
Mikhail Glukhikh c652cd2245 Fix typo 2021-11-26 09:18:11 +03:00
Alexander Udalov 40162dbf89 Proofread -Xjvm-default description 2021-11-25 19:42:56 +01:00
Ilya Goncharov 98bedf7eed [IR] More user-friendly compilation exceptions from lowerings and JS codegen
Merge-request: KT-MR-5004
2021-11-25 13:21:34 +00:00
Stanislav Erokhin 8a0969156f Do not set "idea.plugins.compatible.build" -- fix plugin update issue
In the IDEA plugin update there are a code that used system property
"idea.plugins.compatible.build" to calculate the IDEA version
that will be sent to plugin marketplace to download last version of
the plugins. It seems like by some reason setupIdeaStandaloneExecution()
was called from the IDEA thread and because of that idea version was
calculated incorrectly and incorrect version of the plugins was
downloaded.

It is still unclear how the setupIdeaStandaloneExecution() could be
called from the IDEA, so added logging for that.

Relevant issue: MP-3702
Relevant code in the IDEA:
- ApplicationInfoImpl.getPluginsCompatibleBuildAsNumber
2021-11-25 15:50:37 +03:00
Jinseong Jeon edc17a9d5f FIR LC: populate no-arg constructor if needed 2021-11-25 12:53:54 +01:00
Dmitry Petrov 88f41d006a FIR2IR don't generate delegates for default interface members 2021-11-25 13:25:36 +03:00
Mads Ager 261482904c [FIR] Give external package fragments different module descriptors.
The inliner uses module descriptors to figure out if it needs to
regenerate objects.

We should avoid the use of descriptors in the inliner, but this
works as a first quick fix.
2021-11-25 13:20:31 +03:00
Roman Artemev a01d9b77c3 [JS IR] Delegate invalidated files processing to the caller
This change is needed to test invalidation somehow
2021-11-25 11:22:45 +03:00
Vladimir Dolzhenko 0495ba2495 avoid unnecessary collection copying 2021-11-25 02:22:44 +03:00
Vladimir Dolzhenko 42837415f0 Use nameFilter if all descriptors have not calculated
#KT-49821 Fixed
2021-11-25 02:22:40 +03:00
Ivan Kochurkin f046f2964b [FIR] Add PLATFORM_CLASS_MAPPED_TO_KOTLIN 2021-11-24 23:13:41 +03:00
Ivan Kochurkin 51b73bb6ae [FIR] Add REDUNDANT_NULLABLE diagnostics 2021-11-24 23:13:40 +03:00
Ivan Kochurkin 4caf3c5e83 [FIR] Add NOT_A_CLASS diagnostics 2021-11-24 23:13:40 +03:00
Ivan Kochurkin aff885bcd1 [FIR] Prevent potential exponent complexity in isValidTypeParameterFromOuterDeclaration 2021-11-24 23:13:39 +03:00
Ivan Kochurkin 3beb447e85 [FIR] Consider anonymous object declarations in classDeclarationsStack in transformers 2021-11-24 23:13:38 +03:00
Ivan Kochurkin b83ed7a6ed [FIR] Fix KtExpression.usedAsExpression for labeled expression 2021-11-24 23:13:37 +03:00
Ivan Kochurkin c92c77638a [FIR] Use CharSequence instead of String in getRawIdentifier to avoid extra string allocations 2021-11-24 23:13:36 +03:00
Ivan Kochurkin 2241887b8f [FIR] Drop RESOLVED_TO_UNDERSCORE_NAMED_CATCH_PARAMETER, always resolve to UNRESOLVED_REFERENCE 2021-11-24 23:13:35 +03:00
Nikolay Krasko 4e806a6322 Bump junit-bom in our project 5.7.0 -> 5.8.1 and clean up old versions 2021-11-24 19:35:35 +03:00
Nikolay Krasko 317b0b4495 Update junit dependency 4.12 -> 4.13.2 in tests 2021-11-24 19:35:32 +03:00
Dmitry Petrov 91b1814b02 FIR2IR insert implicit cast on elvis RHS 2021-11-24 16:19:11 +00:00
Dmitry Petrov badfade2fd FIR2IR strip FlexibleNullability on IMPLICIT_NOTNULL 2021-11-24 16:19:10 +00:00
Mikhail Glukhikh 0058d7e3d6 Add BB test for problem fixed with c2ab91d0 2021-11-24 15:30:33 +03:00
Ilya Goncharov 1481ad21f5 Enum implementing exported interface
[JS IR] Not export get instance enum function

[JS IR] Enum corresponding class is not considered in export

[JS IR] All enums are abstract and with private constructor

[JS IR] Any methods is left in d.ts

[JS IR] Make enum with declarations inside corresponding class

[JS IR] Export of interface through fake override

[JS IR] Include enum entry corresponding class members into export model

Merge-request: KT-MR-5031

^KT-49779 fixed
^KT-49773 fixed
2021-11-24 12:25:50 +00:00
Nikolay Lunyak 8d647fa016 [FIR] KT-49265: Fix implicit visibility checks 2021-11-24 14:44:50 +03:00
Pavel Kunyavskiy 98fa69c3d5 [K/N] Remove hack from suspend function inheritance to allow export
Before that commit, function in coroutine implementation class was
override for both SuspendFunctionN's and FunctionN+1's invoke,
which somehow works, but breaks exporting classes with such functions.

Now it's two separate functions, as it should be normally.

^KT-49395
2021-11-24 07:54:51 +00:00
Mikhail Glukhikh c2ab91d048 Drop not enhanced Java static methods in Fir2IrLazyClass 2021-11-23 21:56:05 +03:00
Ilya Kirillov e12479dd89 FIR IDE: fix access to unresolved type parameter 2021-11-23 19:08:59 +03:00
Mads Ager 8255118204 [JVM] Do not extend local ranges across control-flow merges.
The coroutine method transformer extends the range of locals
across code where the local is not live when it is safe to do
so. However, it only bailed out for one case of control-flow
merging, namely backwards branches for loops. That is not
sufficient as there can be control flow merges without loops
where the local is only defined on one control-flow path.

This change generalizes the bailout to any control-flow merge.

^KT-49834 Fixed
2021-11-23 13:49:45 +01:00
Ilya Kirillov 8ace9e45b9 LL API: unmute passing test 2021-11-23 15:41:03 +03:00
Dmitry Petrov 55d1fdfbc2 JVM_IR prevent clash of unsubstituted special bridges 2021-11-23 12:05:13 +00:00
Dmitriy Novozhilov 1e98748e0b [Test] Increase timelimit for running separate jvm process in box tests
Timelimit is increased from 1.5 to 3 minutes because in some cases
 (in parcelize tests) on windows tests can don't fit in 1 minute
 limit, which causes flaky failures of tests

Value of 3 minutes is taken from old parcelize tests
2021-11-23 15:01:37 +03:00
Dmitriy Novozhilov 6b330fb5d5 [FIR] Set proper return type for LighterASTNode.getChildren utility 2021-11-23 15:01:32 +03:00
Dmitriy Novozhilov 8cdddbfd9d [FIR] Implement checkers for FIR parcelize plugin
There is one of checks left unimplemented (FirParcelizePropertyChecker.checkParcelableClassProperty)
  because it requires huge commonization of detecting which type can be
  serialized and which not, which is not prioritized job for now
2021-11-23 15:01:31 +03:00
Dmitriy Novozhilov cb0705ec03 [FIR] Change scheme of generating declarations by plugins
Methods `needToGenerateAdditionalMembersInClass` and
  `needToGenerateNestedClassifiersInClass` are removed, now compiler
  uses `get...Names` and `getTopLevel...` methods to determine which
  extension may generate declaration with specific classId/callableId

This is needed to simplify API of FirDeclarationGenerationExtension and
  provide guarantee that `generate...` method will be called with
  specific classId/callableId only if specific extensions returned name
  for this id from `getName...` functions
2021-11-23 15:01:28 +03:00
Dmitriy Novozhilov b0f38bd996 [FIR] Save mapping from supertype to delegated field in class attribute
This is needed to let checkers know which specific interface was
  implemented by delegation
2021-11-23 15:01:21 +03:00
Dmitriy Novozhilov e25fff701b [FIR] Add FirClassLikeDeclarationChecker alias
Such checkers may be useful for checkers which are interested in all
  inheritors of FirClassLikeDeclaration
2021-11-23 15:01:21 +03:00
Dmitriy Novozhilov 33f78e3903 [FIR2IR] Fix collecting declarations for Fir2IrLazyClass
Existed code might lose declarations in two cases:
1. When there is a declared function which is mapped to property
    (java synthetic properties)
2. When class has property and function with same name
2021-11-23 15:01:20 +03:00
Dmitriy Novozhilov 307fa66dda [FIR] Resolve imports before plugin annotation phase
This is needed to correctly resolve imported annotations from plugins
2021-11-23 15:01:18 +03:00
Dmitriy Novozhilov 9948ba57c0 [FIR] Add ability to generate companion object from compiler plugin 2021-11-23 15:01:15 +03:00
Dmitriy Novozhilov 75ed11a620 [FIR] Remove few unused utils 2021-11-23 15:01:10 +03:00
Dmitriy Novozhilov 75b6f7ca00 [FIR] Make FirRegularClass.companionObject companionObjectSymbol field
This is needed for two reasons:
1. Before this change companion object appeared in FirRegularClass
  twice: in declarations list and in companionObject field. This may
  trigger twice transform of it
2. It's very hard to implement generation of companion object by plugins
  because if it is part of the tree then generated declaration must be
  registered in FirProvider, which is inconsistent with other generated
  declarations. Replacing FIR with symbol and removing custom logic of
  visiting/transforming companion FIR allows us to just replace companionSymbol
  in FirClass if plugin wants to generate it without any additional work
2021-11-23 15:01:05 +03:00