Commit Graph

24 Commits

Author SHA1 Message Date
Dmitriy Novozhilov af79265f42 [FIR] Fix creating overrides for functions with name same as renamed in JVM builtins 2021-03-02 19:11:15 +03:00
Mikhail Glukhikh 2bf3abcb29 FIR: cache accessor symbols in JavaClassUseSiteMemberScope 2021-02-26 12:27:07 +03:00
Denis.Zharkov a750d9466e FIR2IR: Rework resulted overridden-relation structure
The difference is how we deal with intermediate fake overrides
E.g., in case

interface A { /* $1 */ fun foo() }
interface B : A {
     /* $2 */ fake_override fun foo()
}
interface C : B {
   /* $3 */ override fun foo()
}

We've got FIR declarations only for $1 and $3, but we've got
a fake override for $2 in IR.

Previously, override $3 had $1 as its overridden IR symbol, just because
FIR declaration of $3 doesn't know anything about $2.

Now, when generating IR for $2, we save the necessary information
and using it for $3, so it has $2 as overridden.

So, it's consistent with the overridden structure of FE 1.0 and this
structure is necessary prerequisite for proper building of bridges
for special built-ins.
2021-02-20 10:59:22 +03:00
Denis Zharkov 4c9a4548f2 FIR: Fix overrides binding for Java inheritor
`overriddenMembers` contract requires original (non-enhanced) function
See other usages

Ignored tests have been working accidentally

^KT-43289 Open
2020-11-16 15:50:39 +03:00
Dmitry Petrov e018f2bd3e JVM_IR more precise check for special bridges in super class
KT-41123
2020-10-02 12:51:49 +03:00
Mark Punzalan 238cc7c257 [FIR] Enable BytecodeText tests for FIR.
143 out of 767 tests (18.6%) are currently failing.
2020-09-29 10:21:21 +03:00
Steven Schäfer 9d63412b3e JVM IR: Produce correct generic signatures for special bridge methods 2020-07-27 17:02:24 +02:00
Mads Ager 8bc360fa0c Properly link properties and their getter/setters.
This allows removing a hack in the MethodSignatureMapper.

When introducing non-getter methods that dispatch to a getter
we have to be careful to use the right name.

DeepCopyIrTreeWithSymbols should create the link between new
properties and their new getter/setter.
2020-04-22 16:26:59 +02:00
Steven Schäfer 951b2fa770 JVM IR: Optimize type checks to null checks if possible 2020-02-07 18:44:50 +03:00
Steven Schäfer 07737f8fc6 JVM IR: Fix BridgeLowering 2020-02-07 18:44:50 +03:00
Georgy Bronnikov 72ea4cc3d7 Remove descriptors from BridgeLowering 2019-02-23 00:42:16 +03:00
Mads Ager 3a11322506 Enable bytecode text tests for the JVM_IR backend. 2018-12-21 16:20:45 +01:00
Denis Zharkov d259b91143 Add MutableMap.remove(K, V) as built-in declaration
Use PlatformDependent annotation to guarantee it's only be available for JDK8
Also adjust type-safe bridges and mutable collection stubs generation
2016-04-29 15:08:54 +03:00
Denis Zharkov 68f411395a Fix bridge generation for special builtin override
Use method itself signature as common bridge delegate

 #KT-11285 Fixed
2016-03-07 09:26:02 +03:00
Denis Zharkov fa99ea1e98 Generate type-safe barrier in method body
In cases when signature of special bridge is the same as current method,
but type is not 'Any?'.

Also there is tiny optimization:
only null check needed if value parameter type is mapped to Object,
but it's not nullable.

 #KT-9973 Fixed
2015-11-17 16:27:02 +03:00
Denis Zharkov 1f704e0c4d Minor. Split BytecodeText tests about special builtin bridges 2015-11-17 16:27:02 +03:00
Denis Zharkov fafca76ac5 Generate common bridges for final builtin declaration
#KT-9596 Fixed
2015-10-17 17:46:17 +03:00
Denis Zharkov 7cbab5816c Fix lost testData 2015-10-16 21:11:05 +03:00
Denis Zharkov 495780f5ab Generate INVOKEVIRTUAL 'contains(Object)' instead of 'contains(String)'
In cases when callee overrides Collection<String>.contains
2015-10-16 18:16:02 +03:00
Denis Zharkov d335f71dfe Generate special bridges for builtins with same name but different JVM descriptor 2015-10-16 18:16:02 +03:00
Denis Zharkov 5c2fd75389 Minor. Clarified comments in test 2015-10-14 20:39:46 +03:00
Denis Zharkov 89ded4ab1d Implement hack to support both remove() and removeAt() in MutableList<Int>
Also add couple of tests about CharSequence.get
2015-10-11 19:57:22 +03:00
Denis Zharkov 80da320c2c Customize JVM signature for Collection's members
- Do not write signature for `contains`
- Write signature for `containsAll` as it's declared like `containsAll(Collection<?>)`
2015-10-09 14:40:33 +03:00
Denis Zharkov 6a1566a6dc Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
2015-10-07 08:46:35 +03:00