Commit Graph

9802 Commits

Author SHA1 Message Date
Steven Schäfer e25a09f2f9 JVM IR: Fix local delegated properties with inline class types 2019-10-07 17:12:30 +02:00
pyos cd47c11efd Generate unique parameter names in LocalDeclarationsLowering 2019-10-07 15:14:48 +02:00
Mads Ager 3b2843fe7a Introduce local variable type checker.
CheckLocalVariablesTableTests will now check the validity of
the locals table against types of locals computed based on the
bytecode.

These checks and the new destructuringInFor test act as a
regression test for the changes in
https://github.com/JetBrains/kotlin/pull/2613

These checks also caught a similar issue for destructuring
lambda parameters, where the local is introduced before the
value has been written to the local slot. This change also
fixes that.

Finally, this change fixes the asmLike tests to correctly
look up the name of parameters in the locals table.
2019-10-07 15:06:44 +02:00
Steven Schäfer 3659b517bb Minor: Fix some test cases 2019-10-07 12:54:11 +02:00
pyos 6e9ee2a46c JVM_IR: fix const reads from other files in same module 2019-10-07 12:28:55 +02:00
Steven Schäfer 0b76f60b63 JVM IR: Handle NonInlinedConst 2019-10-05 10:52:59 +02:00
Jiaxiang Chen 0a2812f83b Add a JVM backend debug information test, this commit is for verifying
line numbers for stepping.

Running JVM instance and read stepping events from it to verify with the
test data.
2019-10-05 10:41:11 +02:00
Mikhail Glukhikh 813e35643c FIR resolve: fix constructor handling in qualifier scope
Constructors aren't more visited twice in regular scopes
2019-10-04 18:59:10 +03:00
Anton Bannykh aad9cbbf01 [JS IR BE] Fix tests failing due to reduced runtime 2019-10-04 17:30:45 +03:00
Pavel Kirpichenkov b7e5d9faae Update annotation rendering in diagnostics
Disable annotation rendering in default type and descriptor renderers.
Preserve annotations in Android and Serialization plugins.
Update error texts in ide tests.
Nullability annotations in Java descriptors are rendered with context-dependent renderer.

#KT-20258 Fixed
2019-10-04 11:18:45 +03:00
Igor Yakovlev f1f4bc6c2a Fix IdeRegression.testImplementingMutableSet test data 2019-10-04 09:55:39 +03:00
Georgy Bronnikov 4b5877f3b5 JVM_IR, codegen: handle names for classes within local classes 2019-10-03 17:11:48 +03:00
Svyatoslav Kuzmich 5d7f18b1b9 [JS] Support wrapped and dynamic types in typeOf 2019-10-03 13:12:46 +03:00
Mikhail Glukhikh e8cf0b5d4f Add test for kotlin.streams function usage in Kotlin code
NB: does not pass in javac mode due to lack of JvmPackageName support
2019-10-03 11:16:24 +03:00
Igor Yakovlev 32a8fe1ca9 Fix IdeRegression.testImplementingMutableSet test data 2019-10-02 20:18:24 +03:00
Dmitry Petrov a633a33627 KT-14513 Don't generate delegated property metadata when unused
If the delegated property operators involved are inline, and delegated
property metadata parameter is not used (which is often the case, e.g.,
'lazy'), we can skip those properties in metadata generation.

NOT implemented: special case when only 'kProperty.name' is used by the
corresponding delegated property operators.

Also a sneak fix for KT-34060.
2019-10-02 17:14:48 +04:00
Dmitry Savvinov 3989f351ff Use modules instead of files for MPP diagnostic
Using files turned to be a bad idea, because people often
use the same name for files with expects and with corresponding actuals.

This commits disambiguiates ambiguous message for
AMBIGUOUS_ACTUALS/AMBGIUOUS_EXPECTS diagnostics by using modules instead
of files

^KT-32582 Fixed
2019-10-02 16:52:40 +03:00
Georgy Bronnikov e38ff8753e JVM_IR: support type parameters in @JvmOverload functions 2019-10-02 16:19:06 +03:00
pyos ea56a5e8b1 Unmute some JVM_IR inlining tests 2019-10-02 14:48:05 +02:00
Denis Zharkov e54d2c7c32 Support named arguments in their own position
^KT-7745 In Proggress
2019-10-02 11:13:15 +03:00
Steven Schäfer 217f681b6e JVM IR: Use WrappedClassDescriptor in class builder. 2019-10-02 08:29:22 +02:00
Georgy Bronnikov 4920d71d70 JVM_IR: set dispatchReceiverParameter of imported JvmStatic object methods to null 2019-10-01 20:52:56 +03:00
Igor Yakovlev cef6b71897 Fix ultraLightClass method argument types erasure
Fix IdeRegression.testImplementingMap test
2019-10-01 13:53:20 +03:00
Denis Zharkov f91db5f0b8 Restore correct overloads ambiguity accidentally removed in 1.3.60
This problem is only relevant when isTypeRefinementEnabled == true (HMPP projects)

Ambiguity accidentally was removed after 471134d
There, for areCallableDescriptorsEquivalent we stopped assuming
as impossible a situation of having identity-different descriptors
in the same containing declaraton that still might be considered equal

So, before 471134d we were comparing
"fun foo(x: String)" with "[substituted] fun foo(x: String)"
and areCallableDescriptorsEquivalent returned false for such case.
Thus, both overrides were left in the resulting set.

After 471134d, those two descriptors
becamed considered as equal thus having a possibility to remove any of them.

The problem is that "areCallableDescriptorsEquivalent" has kind of
unclear contract. Effectively it checks whether two descriptors match
to the same declaration.

But some of the usages expect that it also makes sure that descriptors
have the same substitution (see org.jetbrains.kotlin.resolve.calls.smartcasts.IdentifierInfo.Variable#equals)

So, the straight solution is using original descriptors for the cases
where we need to make sure that descriptors relates to actually different
declarations

^KT-34027 Fixed
2019-09-30 20:09:42 +03:00
Ilmir Usmanov 08794d17a0 Do not box function argument if it is used in EXACTLY_ONCE lambda
Since we cannot change type of parameter, we cannot replace it with
box type.
 #KT-29510 Fixed
 #KT-29614 Fixed
 #KT-29385 Fixed
2019-09-30 17:42:17 +03:00
Mikhail Zarechenskiy 932d84d568 Fix performance regression in NI by fixing totally incorrect hashCode
The actual problem was introduced in 4f1e85b468, note how `hashCode` is implemented:
```
var currentHashCode = cachedHashCode
if (currentHashCode == 0) return currentHashCode
...
```
It's a silly bug, there should be check `if (currentHashCode != 0) ...` because `0` is used a marker for "uncomputed value".

Now, in the commit 0219b86d06 I added map with `KotlinType` as a key and because of constant `hash` for `KotlinType`, we basically got `List` instead of `Map`, which caused this performance regression

 #KT-34063 Fixed
2019-09-30 10:22:30 +03:00
Natalia Selezneva 66a6713577 Tests: extract scripts testdata for light classes in ide to separate test
For compiled scripts there is AbstractIdeCompiledLightClassTest
For now there is a difference in light classes constructed from source and from compiled class (missing baseClass and constructor parameter for script class)
But it doesn't affect users because calling script class from Java isn't supported yet

testData for AbstractIdeLightClassTest and AbstractIdeLightClassForScriptTest can be merged when the difference will be fixed
2019-09-30 09:47:20 +03:00
Anton Bannykh ead8379c50 JS: add -Xmetadata-only flag for JS common code modules (KT-33142 fixed) 2019-09-27 19:12:03 +03:00
Mark Punzalan c16b59191b Do not cache "last" value (i.e., size/length) in lowered for-loop
iteration over CharSequences.

CharSequences may be mutable (e.g., StringBuilder) and therefore its
contents and length can change within the loop.
2019-09-27 13:44:40 +02:00
Natalia Selezneva de369e6527 Revert "Fix testdata for IdeLightClassTestGenerated.Script after scripting API refactoring"
This reverts commit a3f4effe
2019-09-27 10:52:16 +03:00
Mikhail Glukhikh 4718ae4186 FIR: don't perform argument check for callable references
This fixes failing FIR2IR test
2019-09-27 09:23:34 +03:00
Mikhail Glukhikh da7d5d5702 FIR: provide receiver for accessor of extension property 2019-09-27 09:22:52 +03:00
Natalia Selezneva a3f4effe3e Fix testdata for IdeLightClassTestGenerated.Script after scripting API refactoring
Generated script class no longer has a supertype
2019-09-26 14:24:47 +03:00
Svyatoslav Kuzmich 7592048437 [JS] Support typeOf 2019-09-25 18:12:55 +03:00
Pavel Kirpichenkov 6c8e829f19 Update diagnostics for trailing lambdas, add quickfix
Alternative message for errors, caused by unexpected lambda expression arguments on a new line.
Both diagnostic are reported, if multiple lambda expressions were passed to the call.
For other errors trailing lambda diagnostic overrides the original one.

Quickfix for erroneous trailing lambdas on a new line after call.
Fix separates lambda expression from previous call with semicolon.
All trailing lambda arguments become standalone lambda expressions.
2019-09-25 15:38:17 +03:00
Steven Schäfer f49d5da929 JVM IR: Fix enum constructor visibility 2019-09-24 13:28:08 +03:00
Kristoffer Andersen 52dc469657 JVM IR: Generate synthetic methods for type aliases with annotations 2019-09-24 12:21:42 +02:00
Igor Yakovlev fc70fd05fc Enable kotlin.collections support for UL classes
Removed restriction for classes derived from Kotlin collections
Added type erasure for java collection overrided methods
2019-09-23 17:30:15 +03:00
Steven Schäfer e4609a9968 JVM IR: Cache inline class replacements at the module level 2019-09-20 23:41:39 +02:00
Steven Schäfer f40f9611c3 JVM IR: Fix spread operator on unsigned array type 2019-09-20 18:17:31 +02:00
Mikhail Zarechenskiy a83225218f [NI] Fix checks for infix/operator conventions 2019-09-20 17:56:06 +03:00
Pavel Kirpichenkov f45a49b122 Remove uncapturing in type mismatch diagnostics
#KT-32587 Fixed
2019-09-20 17:05:03 +03:00
Alexander Udalov a7b984bcbf JVM IR: fix generation of generic multi-file delegates 2019-09-19 22:23:16 +02:00
Alexander Udalov acbe5c4e21 JVM IR: fix IOOBE from remapTypeParameters for synthetic property annotations method 2019-09-19 22:23:16 +02:00
Ilmir Usmanov f1d31c8221 JVM_IR: Minor. Unmute tests
Rename FAKE_CONTINUATION -> fakeContinuation
2019-09-19 19:28:11 +03:00
Ilmir Usmanov 06d0e8a521 JVM_IR: Support suspend functions with extension receivers 2019-09-19 19:28:10 +03:00
Ilmir Usmanov 2bfd17d8fb JVM_IR: Minor. Unmute test. 2019-09-19 19:28:08 +03:00
Ilmir Usmanov 63f6d515bc JVM_IR: Generate correct invoke of numbered suspend lambda
Instead of continuation type as last parameter's type, generate Object
type.
2019-09-19 19:28:05 +03:00
Ilmir Usmanov 587fcafc85 JVM_IR: Support continuation crossing inline lambda boundaries
I.E. generate fake continuation markers.
2019-09-19 19:28:03 +03:00
Mads Ager 507857d452 [IR] Support Collection<*>.indices in for loop lowering.
Unmute a couple of tests that are working as intended.
2019-09-18 19:00:17 +02:00