Commit Graph

370 Commits

Author SHA1 Message Date
Pavel Punegov dd1c9fa9f0 Native: Ignore tests that use reflection not implemented in native 2018-10-10 19:01:35 +03:00
Pavel Punegov 82b59c5044 Native: Ignore tests that use jvm or full reflect 2018-10-10 19:00:50 +03:00
Dmitry Petrov b55b0c1ff1 Support local property delegation to inline class values
Also, add extra test on property delegation.
2018-10-03 11:09:48 +03:00
Dmitry Petrov 6fa436911a Support interface delegation to inline class values (KT-27318) 2018-10-03 11:09:47 +03:00
Dmitry Petrov 5480bf69e8 Support property delegation to inline class values (KT-27070) 2018-10-03 11:09:46 +03:00
Dmitry Petrov 70e60ea9bc Fix inline class coercion in string template with StringBuilder.append
Inline class values with array as a carrier type were not boxed.

 #KT-27113
2018-10-03 11:09:41 +03:00
Dmitry Petrov 7b7cf39388 Fix inline classes coercion in 'if' expression
#KT-27132
2018-09-28 10:46:42 +03:00
Dmitry Petrov ab90b2b901 Fix nullability propagation in inline class type mapping
#KT-27096

See https://jetbrains.slack.com/archives/C06E082M6/p1537949572000100
2018-09-28 10:46:42 +03:00
Dmitry Petrov 0b23ddb947 Add test for KT-27140 2018-09-28 10:46:42 +03:00
Dmitry Petrov ba32ed7404 Test: @JvmField in inline class companion 2018-09-25 11:15:29 +03:00
Dmitry Petrov bffe9e45e8 Add accessor tests: inline class <-> companion
KT-26858 was fixed somewhere in the middle.

 #KT26858
2018-09-25 11:15:29 +03:00
Dmitry Petrov 850d72f13f Fix accessor generation for inline class members
TODO 'generateMethodCallTo' is a bloody mess that deserves rewriting.
2018-09-25 11:15:29 +03:00
Dmitry Petrov edc8cf3ed0 Use proper type for context 'this'
Bug in 'generateThisOrOuterFromContext', it worked while instance of a
class was always an object.

 #KT-27078
2018-09-25 11:15:29 +03:00
Dmitry Petrov c1bb3479df More tests on casts on receiver of inline class type 2018-09-25 11:15:29 +03:00
Dmitry Petrov 88cc900dc7 Add test for private inline class method call from inline lambda 2018-09-25 11:15:29 +03:00
Dmitry Petrov 2e6d53a43f Fix extension receiver coercion for inline classes
#KT-27031
2018-09-25 11:15:29 +03:00
Dmitry Petrov 20d7210239 Fix outer class mapping for closures in inline class
#KT-27030
 #KT-27033
2018-09-25 11:15:29 +03:00
Dmitry Petrov 26602c8443 Minor: move tests 2018-09-25 11:15:29 +03:00
Dmitry Petrov f9a419f940 Fix companion method access from inline class
#KT-27025
2018-09-25 11:15:29 +03:00
Dmitry Petrov 1869ed09bc Fix companion field access from inline class
#KT-26858
2018-09-25 11:15:29 +03:00
Svyatoslav Kuzmich b79dcbe8e6 [JS IR BE] Refactor equals and compareTo lowering 2018-09-24 18:21:57 +03:00
Dmitry Petrov 0f898dc6dc Fix default interface generic extension fun call with inline class type
When we've determined that we are going to invoke an erased inline class
method ('static foo-impl(this, ...)' in inline class), keep track of it
so that the remaining type mapping logic proceeds correctly.

 #KT-26998 Fixed Target versions 1.3.20
2018-09-21 09:48:11 +03:00
Dmitry Petrov 8d2b1950e6 Fix Kotlin default interface methods calls for inline classes
When mapping callable method signature for erased inline class methods,
use original function descriptor instead of super declaration
(otherwise it would map to a default interface method with mismatching
signature).

When generating delegates to Kotlin default interface methods, keep
track of the original Kotlin types for delegating method arguments and
interface method arguments.

'original' for value parameters of fake overrides points to the
overridden function value parameters instead of the value parameter of
the unsubstituted function. This causes inconsistent type mapping for
inline classes implementing generic interfaces with default methods.

 #KT-25295 Fixed Target versions 1.3.20
 #KT-26931 Fixed Target versions 1.3.20
2018-09-21 09:48:11 +03:00
Dmitry Petrov d9593c7a34 Add tests for inline class variables captured in closure 2018-09-21 09:48:11 +03:00
Roman Artemev 89bec8ec59 Update tests 2018-09-18 15:30:17 +03:00
Anton Bannykh 0660e4d616 [JS IR BE] support multimodule tests 2018-09-18 14:36:20 +03:00
Anton Bannykh 2e709a81fa [JS IR BE] Arrays, varargs 2018-09-18 14:36:20 +03:00
Mikhail Zarechenskiy fa9a3868b7 Make generation of assertions for platform types aware of kotlin types
#KT-26859 Fixed
2018-09-17 16:21:06 +03:00
Dmitry Petrov bbbca9fbbf Minor: mute inline classes tests in JVM_IR 2018-09-10 10:42:18 +03:00
Roman Elizarov e2713501ce Rename SuccessOrFailure to Result and hide Failure from ABI
* The members of Result are isSuccess, isFailure, exceptionOrNull, getOrNull
* The rest of API is implemented via inline-only extensions
* There are two internal functions to hide detailed mechanics of an internal
  Result.Failure class: createFailure and throwOnFailure
* Result.toString is explicit: either Success(v) or Failure(x)

See KT-26538
2018-09-09 11:34:31 +03:00
Dmitry Petrov 006c0aa740 Hide constructors accepting inline class parameters 2018-09-07 15:57:59 +03:00
Dmitry Petrov cafaa3e13c Mangle inline class members
<IMPL_SUFFIX> for method is a method signature hash,
if method value parameter types contain inline class types,
otherwise 'impl'.

Constructor methods are named as 'constructor-<IMPL_SUFFIX>'.

Synthesized 'box' and 'unbox' methods are named as
'<METHOD_NAME>-<IMPL_SUFFIX>'.

Erased implementations of overriding and non-overriding methods
are named as '<METHOD_NAME>-<IMPL_SUFFIX>'.

Fully specialized implementation of 'equals' will have a special suffix.
2018-09-07 10:25:53 +03:00
Dmitry Petrov aec173ac5c Minor: fix tests after rebase 2018-09-07 09:32:11 +03:00
Dmitry Petrov 427295525a Minor: mute test in JVM_IR 2018-09-07 09:31:33 +03:00
Dmitry Petrov ae0d980b54 Minor: mute some inline classes tests in JS_IR 2018-09-07 09:29:55 +03:00
Mikhail Zarechenskiy 690762d46c Inline classes ABI: rename equals--impl to equals-impl0 2018-09-06 17:01:01 +03:00
Mikhail Zarechenskiy 83975bd6ac Generate stub for specialized equals inside inline class 2018-09-06 10:39:33 +03:00
Mikhail Zarechenskiy b4674a172e Reserve secondary constructors with bodies inside inline classes
#KT-26575 Fixed
2018-09-06 10:22:01 +03:00
Mikhail Zarechenskiy 002a66fec1 Reserve box/unbox/equals/hashCode methods inside inline classes
#KT-26573 Fixed
2018-09-06 10:20:03 +03:00
Dmitry Petrov a2900282fd Call factory method for primary constructors of inner classes
We might want to add 'init' blocks later, so now, for the sake of
binary compatibility with 1.3-RC binaries, we have to generate these
'constructor' calls.

Note that in some tests inline class boxing is no longer redundant,
because resulting value is passed to 'constructor' as an argument.
2018-09-05 12:20:57 +03:00
Dmitry Petrov 05daa21657 Fix inline class secondary constructor call generation
Don't generate NEW+DUP for inline class constructor calls.
2018-09-05 12:20:57 +03:00
Dmitry Petrov 3080b65f7d Inline (wrapper) class IC extends erased inline class IC$Erased 2018-09-05 12:20:57 +03:00
Roman Artemev 8a871b3f0c Update tests 2018-08-31 15:34:18 +03:00
Ilmir Usmanov 2d04acba42 Update test data of compiler tests, except IR tests 2018-08-30 16:24:41 +03:00
Dmitry Petrov a205019156 Additional tests and fixes for function name mangling 2018-08-30 14:58:54 +03:00
Dmitry Petrov 99498eb7b8 Use 'name-hash' mangling scheme
'-' is allowed as a name character both in JVM and in Dalvik, but can't
be a part of a Java identifier.
2018-08-30 14:58:52 +03:00
Dmitry Petrov a56d1d3ce8 Mangle function names with inline class parameters
Avoid name clashes in cases such as

  inline class Login(val login: String)
  inline class Password(val password: String)

  fun validate(login: Login) { ... }
  fun validate(password: Password) { ... }
2018-08-30 14:58:50 +03:00
Anton Bannykh a83baee67b review fixes + DCE data update + test (un)muting 2018-08-30 14:57:27 +03:00
Anton Bannykh 944c5b6044 JS: modify a test to work around Kotlin/JS Double.toString problems 2018-08-30 14:57:18 +03:00
Anton Bannykh a11c4871ea JS: equals, hashCode, toString support in inline classes 2018-08-30 14:57:16 +03:00