Commit Graph

60486 Commits

Author SHA1 Message Date
Vyacheslav Gerasimov fa1c6c9697 Build: Add missing com.github.node-gradle.node plugin versions 2020-01-13 19:40:08 +03:00
Vyacheslav Gerasimov b2039a9a13 Build: Specify version explicitly for com.github.node-gradle.node 2020-01-13 18:17:43 +03:00
Vyacheslav Gerasimov bf5bba42ce Build: Upgrade gradle enterprise plugin to 3.1.1 2020-01-13 18:17:43 +03:00
victor.petukhov fc7b836151 Fix isNegated psi method in KtWhenConditionInRange
^KT-34395 Fixed
2020-01-13 15:36:33 +03:00
Ilya Kirillov a10f37dd50 New J2K: fix exception when met PsiLambdaParameterType
#KT-35431 fixed
2020-01-13 14:32:48 +03:00
Ilya Kirillov 5be80be74d New J2K: fix converting multiline comment with /* inside
#KT-18001 fixed
#KT-35081 fixed
2020-01-13 14:32:47 +03:00
Ilya Kirillov a87de01c74 New J2K: add missing line break between property and getter
#KT-35739 fixed
2020-01-13 14:32:46 +03:00
Ilya Kirillov b83a529b77 New J2K: fix incorrectly removed line break before constructor comment
That caused class body brace to be under the comment

#KT-35478 fixed
2020-01-13 14:32:45 +03:00
Ilya Kirillov 7bfad12e6a New J2K: correctly convert compound Java assignment expression
#KT-35476 fixed
2020-01-13 14:32:45 +03:00
Ilya Kirillov 6a8a68a263 New J2K: fix UninitializedPropertyAccessException when calculating type of anonymous class
#KT-35395 fixed
2020-01-13 14:32:44 +03:00
Ilya Kirillov 7882f566be New J2K: Fix SOE in nj2k Java declarations printer 2020-01-13 14:32:44 +03:00
Ilya Kirillov 14a8d3726d New J2K: remove initializer from property without backing field
#KT-33637 fixed
2020-01-13 14:32:43 +03:00
Mikhail Glukhikh 1756857237 Rename: FirMemberScopeProvider -> FirDeclaredMemberScopeProvider 2020-01-13 13:26:19 +03:00
Mikhail Glukhikh 5c6341b4e4 [FIR] Handle fully qualified expressions separately in tower resolver 2020-01-13 13:26:13 +03:00
Mikhail Glukhikh 587430ff90 [FIR] Minor: remove FirSymbolProvider unused functions
buildDefaultUseSiteMemberScope & getSessionForClass were removed
2020-01-13 13:23:51 +03:00
Mikhail Glukhikh c343e5c9b7 [FIR] Refactoring: extract FirTowerResolver.towerDataConsumer() 2020-01-13 13:23:51 +03:00
Mikhail Glukhikh c96e6e9da4 [FIR] Refactoring: store name in CallInfo 2020-01-13 13:23:51 +03:00
Mikhail Glukhikh 9e0db86900 [FIR] Refactoring: create consumer inside tower resolver 2020-01-13 13:23:51 +03:00
Mikhail Glukhikh 30e339a2d7 [FIR] Convert CallKind to enum class 2020-01-13 13:23:50 +03:00
Mikhail Glukhikh f07adf085c [FIR] Minor refactoring: createFunctionConsumer 2020-01-13 13:23:50 +03:00
Mikhail Glukhikh 02a57aab7d [FIR] Code refactoring: InvokeReceiverCandidateCollector 2020-01-13 13:23:50 +03:00
Mikhail Glukhikh 5dbb98a5c8 [FIR] Code cleanup: CandidateCollector 2020-01-13 13:23:50 +03:00
Toshiaki Kameyama 6b2e58cc0b Inline function: fix it works correctly for callable reference receiver
#KT-26248 Fixed
2020-01-13 11:59:42 +03:00
Vladimir Dolzhenko 272ca002d7 Drop UNREACHABLE_CODE eager text range calculation
#KT-35242 Fixed
2020-01-12 17:23:30 +01:00
Ilya Gorbunov 9e4d7df86e Revert "[JS IR] stdlib: switch between artifacts rather than artifact content"
The default Jar task is disabled, but its archive file is still
configured as an artifact to be published in the 'archives' configuration.
Thus, neither 'install', nor 'publish' tasks could not find this file
when `libraryJarWithIr` isn't triggered and does not build it.
Removing that artifact from the 'archives' configuration artifacts makes
'install' task publish nothing.

Therefore it's better to revert the change so that 'libraryJarWithIr' task
always runs and produces an artifact with the default name.

This reverts commit a9fec211
2020-01-11 02:27:05 +03:00
Igor Yakovlev e2bb602271 Fix invalid test data file names 2020-01-11 00:03:48 +03:00
Igor Yakovlev 0c4134470d Fix exception of rename readonly overridden methods 2020-01-10 21:37:12 +03:00
Igor Yakovlev 3a2704d956 Remove usage of deprecated method 2020-01-10 21:22:51 +03:00
Igor Yakovlev df2a0e1087 Add MPP warning message for move refactoring 2020-01-10 21:22:51 +03:00
Alexander Udalov 2b4dc1199a JVM IR: fix monitorEnterMonitorExit.kt
After an inaccurate merge of 31936890 and d6ed93b2, this test was now
failing with the newly added assertion. It seems that currently the best
way to handle it would be to special-case these two methods in
SyntheticAccessorLowering.kt.
2020-01-10 18:07:27 +01:00
Mads Ager b2f8a4e82a JVM_IR: Put continuation parameter before default mask and handler.
This is important for calls using reflection as the reflect
library assumes this ordering of arguments.

It would be nice if this could be handled in the lowerings.
Currently AddContinuationLowering is after
DefaultArgumentStubGenerator. If we could add the continuation
first and then do default stub generation maybe we could avoid
the reshuffling introduced in coroutine codegen in this change.
2020-01-10 17:52:46 +01:00
Alexander Udalov c948459ed5 Minor, add comment to synthetic accessor generation for super calls
Also fix "useless elvis" warning in SyntheticAccessorLowering.
2020-01-10 14:09:00 +01:00
Alexander Udalov b48d7f4ba7 JVM IR: fix InterfaceLowering for $default methods from base interfaces
The first change here is swapping the isCompatibility and hasJvmDefault
checks. Otherwise behavior could be different depending on -Xjvm-default
mode even for non-JvmDefault declarations, which makes little sense.

Another change is avoiding generating $default stubs for fake overrides
in interfaces, which replicates the behavior of the current backend.
(Note that this change also fixes the first problem on the newly added
tests, but the first change seems useful anyway.)
2020-01-10 14:05:27 +01:00
Alexander Udalov 3848ac9cac JVM IR: never produce "$s<hash>" suffix for accessors in interfaces
Not sure if this affects real code, but this could happen in erroneous
cases such as in the subsequent commit, where it was a bit weird to see
this suffix without any supercalls involved.
2020-01-10 14:05:26 +01:00
Alexander Udalov 3193689086 JVM IR: do not add suffix for accessors to top level functions
This only reproduced when compiling (technically incorrect) code in the
standard library, where private functions monitorEnter/monitorExit are
accessed from another file, and their names with suffixes are not
recognized as intrinsics which should be replaced by
monitorenter/monitorexit JVM bytecode instructions.
2020-01-10 14:05:25 +01:00
Alexander Udalov d6ed93b2b8 JVM IR: fail when SyntheticAccessorLowering adds accessor to other files
This would help for example in debugging the issue fixed in the previous
commit.

The only problem by now where this lowering tried to add accessors to
foreign files was reproduced for interfaces inheriting from Cloneable.
There, we generate a DefaultImpls bridge that calls protected method
`clone` from java.lang.Cloneable.DefaultImpls. This makes no sense, but
the old backend behaves the same. Instead of generating accessor for it
in JVM IR, we now see all DefaultImpls bridges as public as a
workaround. (The fact that assertion no longer fails here is checked
e.g. by box/reflection/mapping/methodsFromObject.kt.)
2020-01-10 13:53:11 +01:00
Alexander Udalov 957b100cd1 JVM IR: do not generate hidden constructor for inline classes more than once
SyntheticAccessorLowering was initially implemented under the assumption
that any access to an invisible declaration will cause an accessor to be
generated _in the same file_. Moreover, it's declared in the group of
phases that are performed by file.

But this assumption is incorrect for constructors which need to be
hidden (those which take parameters of inline class types), since such
constructor is public and can be called from anywhere. In this case,
SyntheticAccessorLowering actually generated a new accessor for the
hidden constructor for each (!) source file where that constructor is
called, which led to ClassFormatError because of the class file having
multiple methods with the same signature. The internal `functionMap`
cache didn't help because it's not shared among phase instances for
different files (well, it helped to generate not more than one accessor
per usage-file).

In this change, we use the global cache, stored in JvmBackendContext,
for accessors to hidden constructors. Note that after this change, calls
to hidden constructors are always transformed to the corresponding
accessor in SyntheticAccessorLowering right away, but that accessor
might be orphaned for a while (not declared in any parent's
declarations). Only when SyntheticAccessorLowering encounters the
original constructor which needs to be hidden, it adds the accessor
beside it.

The test is sensitive to the file order, so both variants are added.
2020-01-10 13:49:05 +01:00
Sergey Rostov a339e7af19 build.gradle.kts: tests and docs for LastModifiedFiles collection 2020-01-10 15:41:23 +03:00
Dmitry Petrov 4cf8203ce7 PSI2IR: Unify behavior for lambda return values with old back-end
See KT-35849.

1. When expected lambda return type is a type parameter, don't generate
introduce implicit casts (even if the corresponding type parameter has
an upper bound that would otherwise require such cast).

2. Do not generate implicit null check for lambda return value of
@EnhancedNullability type.
2020-01-10 15:23:33 +03:00
Mads Ager c47e04ac8d JVM_IR: handle suspend functions for signatures in callable references. 2020-01-10 11:24:27 +01:00
anastasiia.spaseeva 3253907317 [Spec tests] Hotfix for not-null-assertion-expression test 2020-01-10 13:12:01 +03:00
Pavel Kirpichenkov 2a4e235e34 [NI] Decrease only input types check diagnostic level to warning 2020-01-10 13:05:40 +03:00
Nicolay Mitropolsky 23c2a5c830 Uast: fake light method for uast is created only when containing class exists (KT-35310, EA-219604) 2020-01-10 12:46:37 +03:00
Victor Petukhov 5917591205 Workaround an inliner problem upon which the compiler code itself stumbled
^KT-35856 Fixed
2020-01-10 12:13:46 +03:00
simon.ogorodnik 5b8ab76613 [FIR] Move JvmMappedScope to fir:jvm module 2020-01-10 12:02:10 +03:00
Alex Chmyr 16c82030a3 KT-20120 fixing bug for Java 9 Deprecated
Unconditionally changing it to @Deprecated("") in kotlin
2020-01-10 11:45:17 +03:00
simon.ogorodnik ba4163ba02 [FIR] Improve synthetic functional interfaces support
Rename fictitiousFunctionSymbols -> syntheticFunctionalInterfaceSymbols
Support suspend function interfaces
Add supertypes for KFunction / KSuspendFunction
2020-01-10 10:57:36 +03:00
Juan Chen 573188bdc4 [FIR2IR]: fix translation of this references in instance methods
Currently FirThisReceiverExpression of instance methods are translated
to references of the class' thisReceiver,
not the method's dispatch receiver,
which causes problems with IrFrameMap::typeOf,
as the class' thisReceiver is not in the typeMap.

This commit translates non-qualified "this" references of
instance methods to references of the methods' dispatch receiver.
2020-01-10 10:43:07 +03:00
Mikhail Glukhikh 6b4e5bc2f0 [FIR] Cleanup code and fix type check in SAM resolution 2020-01-10 10:23:53 +03:00
Juan Chen c464322b3a [FIR2IR] Fix translation of library func parameters with default values
In the existing implementation, the information that a library function
parameter has a default value is lost during Fir2Ir translation,
and thus later on,
calls to such functions are not converted to the corresponding stubs.

Test cases such as kt5844, which calls kotlin.test.assertEquals,
fail with messages like "java.lang.IllegalArgumentException:
Null argument in ExpressionCodegen for parameter VALUE_PARAMETER
name:message index:2 type:kotlin.String?",
due to nonnull checks in ExpressionCodegen.visitFunctionAccess
(ExpressionCodegen.kt:421)

Functions defined in the code to be compiled don't have this problem,
only those from deserializing jars.

This commit sets default values in IrValueParameterImpl
for such parameters during Fir2Ir translation.
Now kt5844 passes the nonnull check in
ExpressionCodegen.visitFunctionAccess but still fails in a later stage
(java.lang.ClassNotFoundException: kotlin.internal.ir.Intrinsic).
2020-01-10 10:23:53 +03:00