Commit Graph

86347 Commits

Author SHA1 Message Date
Victor Petukhov 01e853fb9b Introduce error for SUPER_CALL_FROM_PUBLIC_INLINE
^KT-45378 Fixed
2021-09-30 20:08:36 +03:00
Victor Petukhov 70d70b9042 Use warn mode by default for jspecify nullability annotations in 1.6
^KT-48851 Fixed
2021-09-30 20:08:35 +03:00
Yahor Berdnikau 013139f18e Unset MapProperty if not task outputs is present.
By default, Gradle creates such property as empty. 'isPresent' returns
'true' in such case.

^KT-46406 Fixed
2021-09-30 18:55:42 +02:00
Yahor Berdnikau de8d4e9e3c Fix reflection call is not working on older Gradle versions.
It happens, older Gradle versions has two functions with the same name,
but different parameters.
2021-09-30 18:55:42 +02:00
Abduqodiri Qurbonzoda cca5f82aa0 Handle container builders capacity overflow 2021-09-30 16:01:57 +00:00
Abduqodiri Qurbonzoda f8bcba0b76 Align JS String.equals/compareTo(ignoreCase) behavior with JVM #KT-48999 2021-09-30 15:35:50 +00:00
Hung Nguyen b5f74ef9a6 KT-45777: Add tests for top-level functions
Address review + Minor changes
Fix error when building with -Pbootstrap.local=true
Fix tests failing on Windows due to '/' character
2021-09-30 17:57:47 +03:00
Hung Nguyen e26dc4d574 KT-45777: Compute classpath changes based on changed snapshots only
to avoid unnecessarily loading unchanged ones.

Duplicate classes will make this a bit tricky. This commit outlines the
algorithm to handle them, the full implementation will follow later.

Also handle removed classes when computing classpath changes.

Test: New tests in ClasspathChangesComputerTest
2021-09-30 17:57:47 +03:00
Ilya Gorbunov c2af8b2a29 Leave Duration.convert experimental KT-46784 2021-09-30 14:31:54 +00:00
Ilya Gorbunov 04d70162d2 Make DurationUnit not a typealias of TimeUnit on JVM
Provide conversion functions between DurationUnit and TimeUnit
2021-09-30 14:31:54 +00:00
Victor Petukhov 2b1897e362 Provide a proxy for external use of deprecate package org.jetbrains.kotlin.resolve.calls.callUtil
Provided API is `getResolvedCall`, `getType` and `getCall`
2021-09-30 14:05:39 +00:00
Roman Artemev afb7accd5b [IR] Support erasure of recursive non-reified type parameters
In case of `inline fun <T : I<T>> foo(a: Any) = a as T` `T` is being
erased to `I<*>`

Also substitute class upper bound

Fix KT-47342

See KT-31072 for more details
2021-09-30 15:42:04 +03:00
Roman Artemev 882016c22f [IR] Add tests for KT-47342 2021-09-30 15:42:03 +03:00
Alexander Udalov dbd28142d0 Fix callable reference adaptation for vararg in fake override
`mappedVarargElements` are populated with parameters from
`argumentMapping`, which is computed using `ArgumentsToParametersMapper`
which calls `original` on all value parameters (see
ArgumentsToParametersMapper.kt:136).

So the code that adds empty lists for unassigned vararg parameters
should also call `original`. Otherwise, in the added test, we ended up
with two arguments for the parameter `s` in `id(::base1)`, one for
`Base.s` containing the correct value, and another for `Derived.s`
containing the empty list. Psi2ir took the last one, which resulted in
empty array being passed to the vararg parameter.

Note that all of this is caused by the fact that `original` of a fake
override parameter is the parameter of the base function. This seems
suspicious because `original` of a fake override _function_ is that fake
override itself (NOT the base function), but this would probably be very
risky to change at this point.

 #KT-48835 Fixed
2021-09-30 14:08:38 +02:00
Alexander Udalov 9857af7823 Psi2ir: fix function type check for fun interface conversion
Parameter of a synthetic SAM adapter always has a function type (not a
subtype). Checking for the subtypes broke the case from KT-46908, where
fun interface is itself a subtype of a function type.

 #KT-46908 Fixed
2021-09-30 14:07:07 +02:00
Alexander Udalov e6a160e115 Minor, uncomment passing IR text test 2021-09-30 14:07:07 +02:00
Mikhail Glukhikh d3662b48a2 FIR: fix OPT_IN_MARKER_ON_WRONG_TARGET (setter via parameter case)
This commit fixes FIR bootstrap compilation
2021-09-30 14:58:14 +03:00
Alexander Udalov aa247726b6 Prohibit using old JVM backend with LV >= 1.6
#KT-48928 Fixed
2021-09-30 13:56:34 +02:00
Dmitriy Novozhilov e933c7b6d9 [Build] Remove testApi(intellijDep()) dependencies from all modules
Since IDEA moved most of it's jars to java 11 it's illegal to use them
  in our dependencies, so all modules which use `intellijDep()` should
  carefully specify which jars they use
2021-09-30 14:41:31 +03:00
Roman Artemev 504ccbad88 [IR] Copy bound parameters value in Callable reference in inliner
Fix KT-47767
2021-09-30 14:39:05 +03:00
Roman Artemev f644f47360 [IR] Add test for KT-47767 2021-09-30 14:39:01 +03:00
Denis.Zharkov 4733a0d970 Refine naming: *TypeVariable -> *TypeParameter 2021-09-30 14:36:27 +03:00
Denis.Zharkov 7c3383bb39 Fix warnings after KT-48899
All API ToolingModelBuilder is marked as NonNullApi
https://github.com/gradle/gradle/commit/f93bf949486e73655810ab49ad316100b1c2804c#diff-76e89b92025ccef4e2763c5ee8d30bde939c4a9db26bfc913eac88069cbf5d36
2021-09-30 14:36:27 +03:00
Denis.Zharkov f7ef551f99 Report warnings on overrides with wrong types nullability
^KT-48899 Fixed
2021-09-30 14:36:26 +03:00
Denis.Zharkov ec97dab6cd Simplify OverridingUtil
Do not use NewKotlinTypeCheckerImpl
2021-09-30 14:36:25 +03:00
Alexander Udalov b821b26cfe JVM IR: do not try to optimize casts in TypeOperatorLowering
In case the cast value is used as a receiver to a private method call,
the cast is actually necessary, see KT-48927. Also, this optimization
has backfired once already (see kt48659_identityEqualsWithCastToAny.kt).
It seems that the best way to optimize these casts is not to generate
them in the first place, and/or use bytecode postprocessing.

Apparently the only kind of casts which need to be eliminated are those
which occur on an inline class to its supertype. Otherwise the
unsafe-coerce intrinsic is inserted at the incorrect place, and several
tests fail (uncastInlineClassToAnyAndBack.kt, genericOverride.kt,
classGenericOverride.kt).

 #KT-48927 Fixed
2021-09-30 13:32:36 +02:00
Roman Artemev aaa0b41416 [JS IR TEST] Pass recompiled files into backend
NOTE: Temporary disabled until IC codegen is merged
2021-09-30 14:30:14 +03:00
Roman Artemev ebf17188cb [JS IR] Fix backend to make it possible lower partially loaded IR 2021-09-30 14:30:13 +03:00
Roman Artemev 2ca74174d3 [JS IR] Nullify body of declaration on it shouldn't be loaded 2021-09-30 14:30:13 +03:00
Roman Artemev 4bd6e8a034 [JS IR] Pass dirty files into backend and load IR for them only 2021-09-30 14:30:12 +03:00
Sergej Jaskiewicz 43bfe2333c Add Kotlin/JS test data to the Compiler Test Helper config 2021-09-30 10:02:53 +00:00
Nikolay Lunyak 1363a49d30 [FIR] KT-44939: report REDUNDANT_VISIBILITY for explicit public overriding public 2021-09-30 09:09:19 +00:00
Ilya Kirillov 5c3ce67648 Analysis API: introduce KtIntegerLiteralType 2021-09-30 01:46:00 +03:00
Ilya Kirillov 30b1487afc LL API: add checks to the compiler based tests to ensure ConeTypeVariableType are not leaked 2021-09-30 01:45:59 +03:00
Ilya Kirillov 7ed4984d11 Test infra: allow adding new AnalysisHandler's when existing ones present 2021-09-30 01:45:58 +03:00
Ilya Kirillov 451464d635 FIR: do not leak ConeTypeVariableType via diagnostics
ConeTypeVariableType is an internal part of type inference
and should not be leaked outside it
2021-09-30 01:45:57 +03:00
Ilya Kirillov cdde765ad9 FIR: precise lookupTag parameter of ConeTypeVariableType as it always accepts ConeTypeVariableTypeConstructor 2021-09-30 01:45:55 +03:00
Ilya Kirillov d3913b85cf FIR: fix mixed up expected and actual types in ArgumentTypeMismatch reporting 2021-09-30 01:45:54 +03:00
Ilya Kirillov 8d15e0e824 Analysis API: use FirSession from star importing scope for resolving classifiers
Resolve should happen from the use-site of the file to which importing scope belongs to
2021-09-29 22:24:27 +02:00
Tianyu Geng 43257f7688 FIR IDE: rename SymbolKind: MEMBER -> CLASS_MEMBER 2021-09-29 22:24:27 +02:00
Tianyu Geng d968b2ba49 FIR IDE: fix getClosestAvailableParentContext
File could be physical yet the state is `FirModuleResolveStateDepended`
2021-09-29 22:24:27 +02:00
Tianyu Geng 0ade231898 FIR IDE: make KtSymbolProvider.getSymbol work for library symbols 2021-09-29 22:24:27 +02:00
Tianyu Geng 954926e0de FIR IDE: get containing symbol of KtTypeParameterSymbol
As part of this change, we now also allow HL API to get containing
symbol for any KtSymbols.
2021-09-29 22:24:26 +02:00
Tianyu Geng 7c3754f516 FIR IDE: output substitutor from checkExtensionIsSuitable 2021-09-29 22:24:26 +02:00
Tianyu Geng 18a23f26f5 FIR IDE: allow getting overridden symbols on any callable symbols
This way caller don't need to first check if the symbol is allowed to
override. The current API throws for cases like Java field, or enum
entry, which is not very user-friendly.
2021-09-29 22:24:26 +02:00
Tianyu Geng 54b32f6911 FIR IDE: allow get overriding symbols of members in anonymous object 2021-09-29 22:24:26 +02:00
Tianyu Geng 50166c776c FIR IDE: add KtClassInitializerSymbol 2021-09-29 22:24:26 +02:00
Tianyu Geng 6f9712a812 FIR IDE: get property as containing symbol for default accessors 2021-09-29 22:24:26 +02:00
Tianyu Geng 3b48103cd2 FIR IDE: Add API to get implicit receiver types at a position
This will be used in completion contribution.
2021-09-29 22:24:25 +02:00
Tianyu Geng 14452661cc FIR IDE: makes HL ref shortener tolerate missing type arg in type refs 2021-09-29 22:24:25 +02:00