Commit Graph

3400 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy b48614df47 Add test for class literals on inline classes
#KT-28361 Obsolete
2018-11-22 18:10:41 +03:00
Mikhail Zarechenskiy 9d2524a790 Fix failing test because of lack of inference annotation
LINENUMBER was incremented because of added import
2018-11-20 19:36:50 +03:00
Dmitry Petrov 3efb07bf7b Return kotlin ctor mapped to a java ctor even if java ctor is synthetic
This allows working with constructors with inline class parameters using
Kotlin reflection, as described in
https://youtrack.jetbrains.com/issue/KT-27429#focus=streamItem-27-3161148-0-0

 #KT-27913
 #KT-27429
2018-11-20 09:53:18 +03:00
Dmitry Petrov 9082f19c00 KT-25907: Use proper loop parameter type in for-in-CharSequence 2018-11-20 09:52:09 +03:00
Dmitry Petrov 90da274eaa KT-28054: Treat inline class constructor accessors specially 2018-11-19 09:42:03 +03:00
Mikhail Zarechenskiy 3a93cab3b6 Mark JVM specific test with TARGET_BACKEND directive
This is needed to avoid test failing for Kotlin/Native
2018-11-17 22:55:18 +03:00
Mikhail Zarechenskiy 090d3327c0 Use wrapper class of an inline one as a result for javaClass
#KT-28185 Fixed
 #KT-28246 Open
2018-11-16 00:55:01 +03:00
Alexander Udalov 1a2579d8e8 Minor, add test for obsolete issue
#KT-21692 Obsolete
2018-11-15 20:29:34 +01:00
Roman Artemev d5acc8ff5b [JS BE] Set enclosing exception state in finally block
[Fix KT-28207]
2018-11-15 18:44:22 +03:00
Mikhail Zarechenskiy 35fb3ba096 Fix CCE when unboxed inline class receiver is passed to inline function
Initial problem is started in `capturedBoundReferenceReceiver` method
 where we assume that bound receiver is captured for usual call.

 Note that if method is inline then we don't pass actual name reference
 receiver, but pass special CAPTURED_RECEIVER_FIELD, which is then
 is used to find special instructions during inline and fold several
 instructions in `foldFieldAccessChainIfNeeded`.

 As a result, we got unboxed reference receiver for inline call, which
 caused CCE and to fix it we should box receiver one more time during
 inline

 #KT-28188 Fixed
2018-11-14 11:21:04 +03:00
Dmitry Petrov 99d8f2eb0c Support 'call' for primary value of an inline class
Getter of a primary value of an inline class belongs to the box class.
Its arguments should not be unboxed when the method is called.
However, its result might require boxing if it's an inline class value.

When we have an internal primary value, there's no getter method.
In fact, we can use box/unbox methods for inline class directly
(don't forget to box the result, it may be an inline class type value).

 #KT-26748
2018-11-14 09:57:51 +03:00
Mikhail Zarechenskiy d28488eaed Remove WITH_UNSIGNED directive from tests
#KT-25226 Fixed
2018-11-13 11:48:32 +03:00
Mikhail Zarechenskiy 79159947a5 Coerce last value of delegated expression for inline classes
Note that this commit doesn't fix case when some inline class over
 `Any` is returned from a lambda, it'll be fixed further as part of the
 #KT-27586

 #KT-27737 Fixed
2018-11-12 14:21:24 +03:00
Mikhail Zarechenskiy 20ff74a726 Fix mapping for inline classes when JvmSuppressWildcards mode is using
#KT-28097 Fixed
2018-11-12 09:36:05 +03:00
Dmitry Petrov 6d0a403ead KT-26765: Support 'call' for constructors with inline class parameters 2018-11-09 10:21:46 +03:00
Roman Artemev b010d9eef8 Add Contract tests for JS 2018-11-08 17:35:06 +03:00
Svyatoslav Kuzmich 5ea7673950 [JS IR BE] Mute inline class tests 2018-11-08 15:00:32 +03:00
Svyatoslav Kuzmich 43b4b6eaae Add more specific fail messages in inline class box tests 2018-11-08 15:00:31 +03:00
Georgy Bronnikov c20f93ddbf Mute failing test 2018-11-07 19:09:15 +03:00
Dmitry Petrov 1523185734 KT-27948: Use proper KotlinType when comparing with literal 0
#KT-27948
2018-11-07 18:17:29 +03:00
Dmitry Petrov e14f74bc18 KT-27948: Properly coerce values when generating areEqual call
#KT-27948
2018-11-07 18:17:29 +03:00
Dmitry Petrov ac7cc0c08e KT-27706: Dispatch receiver type for constructor accessor is Object 2018-11-07 18:17:29 +03:00
Dmitry Petrov ea4afdaebe KT-27705: Use proper types for captured outer class instance
Call typeMapper only if we have an inline class.
2018-11-07 18:17:29 +03:00
Mikhael Bogdanov d2a205c72d Update synthetic parameter processing logic according to ASM 7 changes
#KT-27774 Fixed
2018-11-07 15:42:57 +01:00
Alexander Udalov 17d740a373 Do not try computing return type in OverloadChecker
Return type is not needed for checking overloads, but querying it may
involve resolving function bodies, which usually happens after overload
checking (see LazyTopDownAnalyzer.analyzeDeclarations) and at this point
can lead to incorrect BACKING_FIELD_REQUIRED value being computed for
some properties (see KT-27895)

 #KT-27895 Fixed
2018-11-07 11:00:15 +01:00
Anton Bannykh 829bdf6061 JS: fix noInline version of inline suspend fun (KT-27611 fixed) 2018-11-07 12:34:00 +03:00
Anton Bannykh 59009430e5 JS: report inline suspend functions to IC
* Also inline suspend lambda'a
* Also use correct JsName's in exported suspend inline fun's
* Also use less unused imports
2018-11-07 12:11:01 +03:00
Roman Artemev 0e7520fde3 [JS IR BE] Fix GetClass on primitive type 2018-11-01 16:51:44 +03:00
Roman Artemev 2d03f87ea5 [IR BE] Support lateinit locals and isInitialized property
* update tests
2018-11-01 16:51:43 +03:00
Roman Artemev 535eea7f48 [JS IR BE] fix enum initialization 2018-11-01 16:51:42 +03:00
Roman Artemev 7f215d3f52 Update tests 2018-11-01 16:51:38 +03:00
Roman Artemev fb709cae92 [JS IR BE] Fix private field names 2018-11-01 16:18:44 +03:00
Alexander Udalov c5275f178a Do not use getMethod/getConstructor in reflection
Use only getDeclaredMethod/getDeclaredConstructor instead. The reason is
that getMethod/getConstructor only finds public-API (public or protected
on JVM) declarations, and to determine if a declaration is public-API in
the class file we used isPublicInBytecode, which was trying to load
annotations on the declaration to see if it was InlineOnly, and that
required lots of time-consuming actions and worsened the stack trace (as
can be seen e.g. in KT-27878). In fact, the implementation of
Class.getMethod is not supposed to do anything complicated except
loading annotations from each superclass and superinterface of the given
class. Doing it in our codebase simplifies implementation and probably
improves performance
2018-10-31 17:21:06 +01:00
Alexander Udalov 2f72f68e1a Fix loading class literal value void.class in reflection
#KT-27878 Fixed
2018-10-31 17:21:05 +01:00
Mikhail Glukhikh cb92009862 Fix maven build + ~50 compiler tests broken by UNUSED_PARAMETER in main 2018-10-26 19:51:20 +03:00
Pavel Punegov 4d5b00d3e3 Ignore test in native: uses Array.fill 2018-10-26 11:33:14 +03:00
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Alexander Udalov c1ab08c8ce Refactor KClassValue to store ClassLiteralValue internally
Only invariant array projections and non-null element types will be
supported soon (see KT-26568), so it makes no sense to store the
complete type in KClassValue. What we need is only the ClassId of the
class, and the number of times it's wrapped into kotlin/Array, which is
exactly what ClassLiteralValue represents.

This change helps in decoupling annotation values from
descriptors/types. The only constant value that depends on descriptors
is now AnnotationValue.

 #KT-26582 Fixed
2018-10-25 16:27:23 +02:00
Roman Artemev 080e1ad5b5 [JS IR BE]
* Fix type parameters for callable references
 * Visit IrCallableReference tree as well
2018-10-25 15:49:22 +03:00
Roman Artemev fb499def59 Update tests 2018-10-25 15:49:21 +03:00
Roman Artemev 9515de0b7e [JS IR BE] Fix name clash between top-level fields 2018-10-25 15:48:42 +03:00
Roman Artemev 91ea377622 [JS IR BE] Fix translation for float literals 2018-10-25 15:48:42 +03:00
Roman Artemev 59b1743c37 Add tests 2018-10-25 15:48:42 +03:00
Roman Artemev 7cb202934c Update tests 2018-10-25 15:48:42 +03:00
Mikhael Bogdanov 612ca87aa3 Support coroutines in Android box tests 2018-10-25 13:34:29 +02:00
Mikhael Bogdanov 1b2145af22 Fix test data 2018-10-25 09:12:26 +02:00
Mikhael Bogdanov e5ef5d096e Fix test data 2018-10-25 09:10:40 +02:00
Alexander Udalov 9394caf9cf Use access to backing field on overridden property with private setter
#KT-27772 Fixed
2018-10-24 12:53:50 +02:00
Mikhael Bogdanov 78fe9d8eee Move 'compileKotlinAgainstKotlin' java 8 tests to common 2018-10-23 16:27:51 +02:00
Mikhael Bogdanov c6b4bae81f Move 'bytecodeText' java 8 tests to common 2018-10-23 16:27:50 +02:00