Commit Graph

7766 Commits

Author SHA1 Message Date
Pavel V. Talanov 498431311c Light classes: test "JvmPackageName" and actual declarations 2018-03-06 12:06:59 +01:00
Pavel V. Talanov 89c82a85d0 Do not build light classes for expect classes
#KT-15482 Fixed
2018-03-05 18:07:36 +01:00
Svyatoslav Scherbina 7a2d761a7d Add minor improvements to psi2ir and IR utilities:
* Generate missing IR parameter declarations in external stubs
* Use origin = FAKE_OVERRIDE in external IR stubs for fake overrides
* Set .parent in external IR stubs
* Set .parent in IR generated by some utility methods
2018-03-02 15:41:48 +03:00
Dmitry Petrov 13a7270129 Generate type parameter declarations for property accessors
This requires "scoped" type parameter symbols, because in the ugly world
of descriptors property accessors have no type parameters of their own.
2018-03-02 14:35:35 +03:00
Dmitry Petrov 31996f1139 Update "defaultness" for property accessor with inherited visibility
Property accessor that overrides a non-default property accessor with
visibility different from the property visibility was incorrectly
considered "default". Corresponding metadata was written incorrectly,
and 'internal' setter call caused NSME

 #KT-23044 Fixed Target versions 1.2.40
2018-03-02 10:54:32 +03:00
Ilmir Usmanov 07ec704228 Fix modifiers generation for companion objects
when language verion is 1.3

 #KT-23002: Fixed
2018-03-01 20:03:26 +03:00
Egor Neliuba 715d5e90ba Clean up test skips after KT-17137
We need to clean these up since primitive array `is` checks work now

(cherry picked from commit b413e9ef51606c51ebfb21bd7ff646b0fb75470a)
2018-03-01 14:26:13 +03:00
Anton Bannykh 4a5e9bbc7f JS: remove -XtypedArraysEnabled flag (always true now) 2018-03-01 14:26:13 +03:00
Anton Bannykh ed80252ba8 JS: fix double compareTo behaviour for NaN and +-0 (KT-22723) 2018-02-28 15:01:58 +03:00
Dmitry Petrov ae7f60a96e Update IR testData after rebase on master 2018-02-28 10:35:13 +03:00
Dmitry Petrov b206bf199f Add type operand symbol for type operator expression 2018-02-28 10:35:13 +03:00
Dmitry Petrov e89047d2cc Generate super classes and overridden functions in proper scope
Such references require proper scope so that local symbols are bound.
Example:

```
fun <T> outer() {
    abstract class ALocal<S : T> {
        abstract fun bar()
    }

    class Local<S : T> : ALocal<S>() {
        override fun bar() {}
    }
}
```

Here local classes have type parameters with upper bounds depending on
function type parameters, and members overriding members in other local
classes.
2018-02-28 10:35:13 +03:00
Dmitry Petrov 02f01efaac Update testData 2018-02-28 10:35:13 +03:00
Dmitry Petrov e5295d0f78 Generate references to overridden declarations as a separate pass
NB currently it relies on overriddenDescriptors in a FunctionDescriptor,
thus maybe incorrect for transformed declarations.
2018-02-28 10:35:13 +03:00
Dmitry Petrov 8fbdf52d34 Chars are not promoted to Int on comparisons 2018-02-27 10:09:17 +03:00
Dmitry Petrov 4bb6c61a5a Don't generate enum entry initializers for 'expect enum class' 2018-02-27 10:08:12 +03:00
Denis Zharkov 5a591be25f Convert SwitchCodegen to Kotlin, prettify and optimize codegen 2018-02-22 11:42:18 +03:00
Ilmir Usmanov 9fdd34ce6e Minor. Add regression test for KT-15930
#KT-15930: Obsolete
2018-02-21 19:32:50 +03:00
Ilmir Usmanov bcf29d106d Minor. Add regression test for KT-18292
#KT-18292: Obsolete
2018-02-21 19:32:41 +03:00
Ilmir Usmanov a0186224b2 Do not report NOTHING_TO_INLINE on suspend inline functions
#KT-22260: Fixed
2018-02-21 19:19:09 +03:00
Dmitry Savvinov d570b863ce Introduce deprecation of companion objects nested classes
Introdude deprecation as per KT-21515. Warning is reported on type
usage, that soon will became invisible. Quickfix by adding explicit
import is added.

Idea behind implementation is to mark scopes that are deprecated (see
ClassResolutionScopesSupport).

Then, during walk along hierarchy of scopes, look at deprecation status
of the scope that has provided this classifier.
Note that we also have to check if there are *some* non-deprecated
visibility paths (because we can see classifier by two paths, e.g. if
we've added explicit import) -- then this type reference shouldn't be
treated as deprecated.
2018-02-21 16:04:49 +03:00
Mikhail Zarechenskiy f23b5103ec Avoid non-null assertions for inline classes based on nullable types
Note that there are more places where assertions for inline classes should refined:
  - lateinit vars
  - values that come from Java
  - type casts (interfaces to inline class type)
2018-02-20 14:41:48 +03:00
Mikhail Zarechenskiy 413e2d7fa1 Fix KotlinType of constructor call for inline classes 2018-02-20 11:58:18 +03:00
Mikhail Zarechenskiy 530dd01ca6 Fix unboxing values of inline class type from type parameters 2018-02-20 11:45:49 +03:00
Dmitry Petrov 99cea07bf4 Correctly map container element type in intrinsic for withIndex
In case of arrays, we couldn't distinguish array of boxed Ints
from array of primitive Ints.

 #KT-22904 Fixed Target versions 1.2.40
2018-02-20 09:18:25 +03:00
Igor Chevdar a2897a29b5 Added tests on default arguments of fake overridden functions 2018-02-19 18:39:08 +03:00
Denis Zharkov 5edfc0f5cd Prohibit labeled returns inside kotlin.suspend argument lambdas
Probably, it would be more correct to skip such lambdas when resolving
the returns' references, but it'd be more complicated and still useless
since non-local returns are impossible in such lambdas
(relevant parameter is noinline)

 #KT-22900 Fixed
2018-02-19 17:30:26 +03:00
Mikhael Bogdanov cc4ab832b7 Properly calculate outermost parent class for sam wrapper
#KT-22906 Fixed
2018-02-19 13:29:56 +01:00
Mikhael Bogdanov d732f0e160 Never delete types from inline functions during inline transformations
#KT-19399 Fixed
2018-02-16 16:48:53 +01:00
Mikaël Peltier 9fb0f59813 KT-17110 Rewrite branches targeting other branches
- Rewrite branches targeting other branches to target directly the
final destination to avoid runtime performance penalties.

Fix of https://youtrack.jetbrains.com/issue/KT-17110
2018-02-16 15:15:52 +03:00
Dmitry Petrov 8bfbbe456f Use NoScopeRecordCliBindingTrace for codegen tests 2018-02-15 16:40:26 +03:00
Mikaël Peltier ef6b6cd261 Fix NPE into isArraySizeAccess 2018-02-15 12:41:33 +03:00
Mikaël Peltier 3c2f137fd5 Exclude tests from JS backend due to a bug into it 2018-02-15 12:41:33 +03:00
Mikaël Peltier be07a348ea Reformat tests 2018-02-15 12:41:33 +03:00
Mikaël Peltier 8676ca34d7 KT-22334 Specialized loops using range such as integer..array.size-1
- Into PrimitiveNumberRangeLiteralRangeValue modifies how bounded
value are created by checking if the high bound range can be modified
to be exclusive instead of inclusive such as the generated code will
be optimized.
- Add black box tests checking that the specialization does not fail
on any kind of arrays.
- Add a bytecode test checking that the code is correctly optimized.

Fix of https://youtrack.jetbrains.com/issue/KT-22334
2018-02-15 12:41:33 +03:00
Mikhail Zarechenskiy 694f5690f9 [NI] Improve diagnostic about unresolved receiver for many candidates 2018-02-14 14:58:05 +03:00
Mikhail Zarechenskiy 3afd4a2f4a [NI] Record all diagnostics from subcalls resolution results 2018-02-14 14:58:04 +03:00
Mikhail Zarechenskiy 6a7a07bf9d [NI] Don't forget to report about unresolved callable reference 2018-02-14 14:58:04 +03:00
Alexander Udalov 60a551404a Refine modality of fake overrides inherited from abstract expected members
In an open expected class inheriting an expected interface, abstract
members are now inherited as _open_ fake overrides, not final. Final was
technically safer but also stricter and thus could be unexpected by the
user. In a final class, abstract members are still inherited as _final_
fake overrides. So, the general rule is now the following: the modality
of an expected fake override, which overrides only abstract members, in
a non-abstract class is equal to the modality of that class

 #KT-22031 Fixed
2018-02-14 12:45:45 +01:00
Mikaël Peltier 8ab7e5c406 KT-10057 Use lcmp instead of Intrinsics.compare
Fix of https://youtrack.jetbrains.com/issue/KT-10057
2018-02-14 09:46:29 +01:00
Denis Zharkov c47c1c5ffd Fix runtime CCE in case of out-projected SAM
Probably, when NI is there this fix will become unnecessary because
there will be no approximation applied, thus the value parameter
will remain Hello<#Captured> instead of Nothing

 #KT-17171 Fixed
2018-02-14 10:29:14 +03:00
Mikhail Zarechenskiy 6baf937a52 Update test files with dumped declarations for NI 2018-02-13 19:50:25 +03:00
Mikhail Zarechenskiy e017e9cb5f Support passing inline class values with spread operator 2018-02-13 13:16:45 +03:00
Mikhail Zarechenskiy 3919dc94e1 Box values of inline class types when passing to function as varargs 2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy 6687751cf5 Generate as check for inline classes using wrapper
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy a88dbefcd9 Generate is check for inline classes same as for primitives
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy d606e5bc89 Correct boxing for functional types containing inline classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy a8a9f774d0 Map inline classes in generic argument position to theirs wrap classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy 1d16d21dbb Fix boxing for non-local and labeled returns with inline classes 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy 80dd5c106e Propagate KotlinType through call generator, fix boxing on arguments 2018-02-13 13:16:42 +03:00