Dmitry Petrov
6949610dcb
'val' in 'when': IEEE754 equality
2018-06-20 14:06:34 +03:00
Dmitry Petrov
67247ee490
'val' in 'when' subject can't have modifiers (annotations are ok)
2018-06-20 14:06:34 +03:00
Dmitry Petrov
53fd883e2a
Additional parser tests for both subject val and expression in 'when'
2018-06-20 14:06:34 +03:00
Dmitry Petrov
bf083314dd
Support 'when' with subject variable in psi2ir
2018-06-20 14:06:34 +03:00
Dmitry Petrov
d6894091a9
Support 'when' with subject variable in JVM BE
2018-06-20 14:06:34 +03:00
Dmitry Savvinov
148d03e365
Add some data flow analysis tests on when
2018-06-20 14:06:34 +03:00
Dmitry Petrov
ae929d0f08
Handle nested when with subject properly
...
Hack: callee expression for when with subject variable is the subject
variable declaration. This solves the problem that all sub-calls in the
expression are implicitly considered to have a single common lexical
scope (and 'when (val x = ...)' introduces a new lexical scope, which
contains 'x').
2018-06-20 14:06:34 +03:00
Dmitry Petrov
758548603e
Extra tests for when with val in subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
c691d64ea8
Minor: fix & reformat after rebase
2018-06-20 14:06:34 +03:00
Dmitry Petrov
8aec99f4b5
Fix parsing variable declaration in when subject
...
- parse destructuring declarations
- parse annotations on variable declaration in when subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
091b935c2d
Introduce separate callee expression for when with subject variable
...
'Subject.Error' is redundant.
'Subject.None' can be an object.
'Subject#dataFlowValue' can be a lateinit property.
TODO: fix
- parsing local extension properties in 'when' subject
- parsing destructuring declarations in 'when' subject
- non-completed calls in nested 'when' with subject variable
- non-completed calls for subject variable in 'in' pattern
2018-06-20 14:06:34 +03:00
Dmitry Petrov
a76bf57694
Minor: remove redundant cast
2018-06-20 14:06:34 +03:00
Dmitry Petrov
5f0c9490bb
Add test for smart cast on a value bound to when subject variable
...
E.g.:
when (val y = x?.foo()) {
null -> ...
else -> ... // 'x' is also non-null here
}
2018-06-20 14:06:34 +03:00
Dmitry Petrov
0a0bc67e8a
Add test for UNUSED_VALUE on when subject variable
2018-06-20 14:06:34 +03:00
Dmitry Petrov
c20c1abb68
Add test for VAL_REASSIGNMENT on when subject variable
2018-06-20 14:06:34 +03:00
Dmitry Petrov
f6d446da47
It's ok to have no subject expression
2018-06-20 14:06:34 +03:00
Dmitry Petrov
7bc89b8871
Report error on illegal variable declaration in when subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
4fe894c03d
Minor: extract variable subject processing to a separate fun
2018-06-20 14:06:34 +03:00
Dmitry Petrov
098d3eb235
Make smart casts work with variable declared in when subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
1eeafc2d0e
Resolve variable declaration in 'when' subject
2018-06-20 14:06:34 +03:00
Mikhail Zarechenskiy
fcacdc1fc5
Fix bridge methods generation when inline class types are used
2018-06-19 20:09:35 +03:00
Mikhail Zarechenskiy
f326fd66be
Propagate KotlinType into if expression codegen for inline classes
2018-06-19 19:54:22 +03:00
Mikhail Zarechenskiy
c8c943e5fe
[NI] Use context for relevant nested call to run call checkers
...
#KT-24808 Fixed
2018-06-19 19:54:21 +03:00
Roman Artemev
f69bd54d6c
[JS IR BE] Update test data
2018-06-19 17:09:31 +03:00
Roman Artemev
b65443dd25
[JS IR BE] Support try-catch-finally in new backend
2018-06-19 17:08:14 +03:00
Pavel V. Talanov
5063a4ce3d
JavaElementFinder: revert to using ContainerUtil.quicksort
...
Fix comparator contract violated exception
Scopes inherited from LibraryScopeBase violate the comparator contract
2018-06-19 13:40:23 +02:00
Alexander Udalov
e689733f69
Revert "Map Kotlin TYPE target to Java TYPE_USE in bytecode"
...
This reverts commit d122406dca .
See KT-23857
#KT-24952 Fixed
2018-06-19 12:08:18 +02:00
Alexander Udalov
863639c9ab
Revert changes to data class equals/hashCode (KT-12330)
...
This looked like a small and useful change, but caused so many issues
(KT-24474, KT-24790, 30b9caea , and another unreported one -- see the
test update in this commit) that it didn't pay off after all. The
optimization is not that critical for now, as it's only relevant for
data classes where component types have trivial equals/hashCode
implementation, which is not very often
#KT-12330 Declined
2018-06-19 12:05:55 +02:00
Mikhail Glukhikh
b87dd07dd1
Redundant companion reference: minor refactoring
2018-06-19 12:48:11 +03:00
Dmitry Petrov
ecd2709a11
psi2ir: type arguments for function references
2018-06-19 11:13:50 +03:00
Mikhail Zarechenskiy
6431934c13
Fix signature mapping for built-in methods inside erased inline class
2018-06-18 18:55:18 +03:00
Mikhail Zarechenskiy
8503194e0d
Temporarily mute test for JS target
2018-06-18 18:36:36 +03:00
Anton Bannykh
b551afb202
JS IR: minor fix for callable ref translation
...
The caching variable has to have no initializers so that there is no
dependence on evaluation order.
2018-06-18 13:15:19 +03:00
Anton Bannykh
43e3314255
JS IR: Remove inline functions with reified type parameters
...
Otherwise we cannot handle type casts
2018-06-18 13:15:19 +03:00
Anton Bannykh
3808d77bf4
JS IR: inliner
2018-06-18 13:15:19 +03:00
Anton Bannykh
d938c91711
JS IR: top-level initializer lowering
2018-06-18 13:15:19 +03:00
Mikhail Zarechenskiy
c5160a6a95
Don't use methods from super interface if call was on inline class type
...
Some methods (like `size` from kotlin.collections.Collection) have
special rules for mapping and overriding. For example, when we call
`size`, normally there will be `INVOKEVIRTUAL size()` in the bytecode,
but for inline classes it should be `INVOKESTATIC ...$Erased.getSize()`
2018-06-18 12:35:31 +03:00
Mikhail Zarechenskiy
246d5e294c
Fix bytecode optimisations for consequent boxing
2018-06-18 11:52:37 +03:00
Mikhail Zarechenskiy
01d9be65bc
Perform bytecode optimisations for inline classes
...
#KT-23742 Fixed
2018-06-18 11:52:36 +03:00
Mikhail Zarechenskiy
7465289811
Introduce jvm backend class resolver to resolve asm types
...
Original author is @dnpetrov
2018-06-18 11:52:34 +03:00
Mikhail Zarechenskiy
5bdd7bca65
Pass GenerationState to OptimizationMethodVisitor
...
Original author is @dnpetrov
2018-06-18 11:52:32 +03:00
Mikhail Zarechenskiy
605cdcd8d8
Allow to use inline classes in 1.3 with warning
2018-06-18 11:52:31 +03:00
Mikhail Zarechenskiy
6db07f71f3
Check feature dependencies targets before report diagnostics
...
For example, if inline classes feature would have state `ENABLED_WITH_WARNING`,
then corresponding warning will be reported on inline functions too
2018-06-18 11:52:29 +03:00
Natalia Selezneva
077554c438
Use field access instead of setter in clone method of KtCodeFragment
...
Fix EA-120381
2018-06-16 00:01:29 +03:00
Alexander Udalov
28da071ff6
Remove usages of deprecated ClsCustomNavigationPolicy
...
#KT-24891 Fixed
2018-06-15 18:58:15 +02:00
Nikolay Krasko
ea3c4fd451
Run single test after Gradle 4.7 update
2018-06-15 18:06:20 +03:00
Roman Artemev
960fba3c4e
Fix test failures
2018-06-15 16:23:06 +03:00
Ilmir Usmanov
192f311128
Minor. Ignore test is JS_IR.
2018-06-15 15:43:56 +03:00
Alexander Udalov
9bf2d129ee
Improve exception message when failing to serialize anonymous object metadata
...
(See KT-20996)
Old message:
Cannot get FQ name of local class: class <no name provided>
New message:
Cannot get FQ name of local class: class <no name provided> defined in private fun x(): <no name provided> defined in root package in file 1.kt
2018-06-15 13:26:44 +02:00
Roman Artemev
dbb360555c
[JS IR BE] Fix logic boolean operations
2018-06-14 19:54:35 +03:00