Commit Graph

2973 Commits

Author SHA1 Message Date
Alexander Udalov dcbb8045bd Disallow function types with big arity on JVM if LV < 1.3 or API < 1.3
The implementation is a bit obscure because this worked on JS since
Kotlin 1.0 and we should not break that; however, on JVM, a diagnostic
will be reported with old language/API version

 #KT-25241 Fixed
2018-07-16 10:41:27 +02:00
Alexander Udalov 56f509ba09 Support function types with >= 23 parameters
See https://github.com/Kotlin/KEEP/issues/107

 #KT-13764 Fixed
2018-07-16 10:41:27 +02:00
Zalim Bashorov 74df1208ae Make "localClassCaptureExtensionReceiver" test more robust and mute it for JS IR BE 2018-07-13 23:42:41 +03:00
Zalim Bashorov 3f0b31dc23 Speed up JS IR BE tests compiling the common parts (runtime + test common utils) once (on demand) and sharing the result between tests
It's a temporary hack until we implement IR based library format.
It relies on the fact that currently, IR BE generates stable (enough) names.​
2018-07-13 23:42:41 +03:00
Alexander Udalov 66b383349f Fix regression in reflection on looking up equals/hashCode/toString in interface
Caused by 4266e50be8 and 8ccbbf71ec. Previously it worked because we
used hardcoded signatures of equals/hashCode/toString and always looked
them up in java.lang.Object

 #KT-25404 Fixed
2018-07-13 18:45:44 +02:00
Georgy Bronnikov f85030b1e6 Remove a file added by mistake 2018-07-13 16:16:39 +03:00
Mikhail Zarechenskiy 820d168607 First, check for inline class type before boxing
The problem was that if `type` is of primitive type, but `KotlinType` is
 actually an inline class type, then anyway we boxed this type as primitive
2018-07-13 15:48:21 +03:00
Georgy Bronnikov 8478c73434 Make @JvmStatic work on JVM_IR 2018-07-13 13:43:02 +03:00
Mikhail Zarechenskiy ef2095e4d3 Mute tests about unsigned types for JS backend 2018-07-13 00:27:12 +03:00
Mikhail Zarechenskiy 4e3674b330 Fix for-in iterator over list of boxed inline class values
#KT-25325 Fixed
2018-07-12 18:53:30 +03:00
Mikhail Zarechenskiy 0308e10c11 Fix for-in iterator over array of boxed inline class values
#KT-25324 Fixed
2018-07-12 18:53:24 +03:00
Anton Bannykh d042038045 JS IR: mute tests with language version 1.0
Long.rem declaration doesn't compile
2018-07-12 14:18:34 +03:00
Anton Bannykh 0579b52d6b JS: enabled codegen box tests for release coroutines 2018-07-12 14:18:34 +03:00
Mikhael Bogdanov 9cf9cb3ecd Fix KotlinType building by IrType: don't miss type parameters of outer for inner class
#KT-25405 Fixed
2018-07-11 15:12:43 +02:00
Anton Bannykh 9c6452778f JS IR: unmute tests 2018-07-11 15:25:41 +03:00
Anton Bannykh ac1a97ad83 JS IR: unmute tests 2018-07-11 14:49:36 +03:00
Mikhail Zarechenskiy 6b73e528ce Ignore test for JS IR because of TODO() function 2018-07-11 11:41:24 +03:00
Mikhail Zarechenskiy 8d24ca65a3 Propagate KotlinType into when expression codegen
This commit removes unneeded boxing when result expression of `when` is
 value of inline class type
2018-07-10 23:10:57 +03:00
Svyatoslav Kuzmich 77ad97a39e [JS IR BE] Bridges construction 2018-07-10 14:11:09 +03:00
Anton Bannykh 07b3b66fd9 JS IR: unmute tests 2018-07-10 13:34:19 +03:00
Ilya Gorbunov be8cb94105 Add failing tests for overflow in empty progressions KT-24204 2018-07-09 22:08:01 +03:00
Mikhael Bogdanov 66e68fbb53 Generate sam wrappers in inlined lambda in same way as in inline function
#KT-24825 Fixed
2018-07-09 15:52:54 +02:00
Denis Zharkov 0b3048f60a Replace trivial usages of suspendCoroutineOrReturn in tests
This is necessary since suspendCoroutineOrReturn gets removed in 1.3
2018-07-09 15:27:19 +03:00
Denis Zharkov a23ce42c80 Replace a couple of usages of suspendCoroutineOrReturn in tests 2018-07-09 15:27:19 +03:00
Denis Zharkov e753e0978f Fix dispatchResume.kt tests after suspendCoroutineOrReturn removal
To leave them COMMON_COROUTINES_TEST use suspendCoroutine instead
But, since it requires for continuation to be called externally
the tests are rewritten
2018-07-09 15:27:19 +03:00
Denis Zharkov 820506d9c6 Fix tests after new Continuation API support
#KT-24863 Fixed
2018-07-09 15:27:19 +03:00
Denis Zharkov f23a0c8fea Add ContinuationAdapter to coroutine tests helpers
It allows having the same Continuation implementations for different
API versions
2018-07-09 15:27:19 +03:00
Denis Zharkov f01e690f49 Minor. Use coroutine test helpers for inline/diagnostics tests
It should help with decreasing test data copy-pasting when
testing against release / pre-release coroutines
2018-07-09 15:27:19 +03:00
Ilmir Usmanov bc8295b137 Minor: regenerate tests 2018-07-05 15:09:13 +03:00
Ilmir Usmanov 4ec82cad90 Minor: add test to call callable references from Java 2018-07-05 15:09:06 +03:00
Ilmir Usmanov 28ad498956 Use AnonymousFunctionDescriptor for suspend callable references
Also use it for local suspend functions, which allows us to remove hack
with dropSuspend.

Regenerate tests.
2018-07-05 15:08:49 +03:00
Ilmir Usmanov eea95441c5 Add diagnostics tests. Forbid callable reference to coroutineContext
#KT-16908: Fixed
2018-07-05 15:08:42 +03:00
Ilmir Usmanov f94b579d19 Implement callable references to suspend functions
In FE they have type KSuspendFunctionN
In BE they are treated like normal callable references with additional
parameter in invoke function.
2018-07-05 15:08:34 +03:00
Mikhail Zarechenskiy 2939d9c8c6 Use correct lhs KotlinType & AsmType for is check generation
There were two problems:
  - For asm type `OBJECT_TYPE` was used, which can be wrong in case of
  inline classes, because it can be an underlying value of some inline class
  - For KotlinType, type from rhs was used
2018-07-05 12:55:43 +03:00
Mikhail Zarechenskiy 4f490ac264 Fix generation of checkcast instructions for inline classes
Normalize LHS and RHS types to use only boxed ones and then let bytecode
 optmizer reduce redundant boxing
2018-07-05 12:55:39 +03:00
Mikhael Bogdanov be40127ab3 Mute coroutines ir-tests in jvm 2018-07-04 15:33:41 +02:00
Svyatoslav Kuzmich 83f8cfaa66 [JS IR BE] hashCode, toString, number conversion support 2018-07-03 19:51:58 +03:00
Roman Artemev d130ba6f44 [JS IR BE] Update test data 2018-07-03 19:14:00 +03:00
Ilya Gorbunov 16fb5f6901 Set language and api versions automatically for unsigned types box tests
Remove InlineClasses feature directive from tests
2018-07-03 03:52:18 +03:00
Alexander Udalov 4266e50be8 Use manual type mapping in reflection for members from built-ins
There are cases when members deserialized from JVM classes have no JVM
signature in the proto. For example, if a member is inherited from a
built-in class (such as Map.getOrDefault in some Map implementations),
or if a member is synthesized in the compiler front-end and back-end
separately (such as enum values/valueOf). In these cases, we'll use the
naive type mapping to try to recover the signature.

 #KT-16616 Fixed
 #KT-17542 Fixed
2018-07-02 18:49:08 +02:00
Alexander Udalov 50c515deca Do not serialize constructors for anonymous objects
The only client of this data is reflection, and since anonymous objects
do not have constructors in the source code, they shouldn't in
reflection as well

 #KT-20442 Fixed
2018-07-02 18:49:08 +02:00
Alexander Udalov 17fc41e0f9 Do not create primary constructor for enum entry synthetic class
The change in DescriptorSerializer is needed so that serialized protos
of enum entry classes which are resolved in sources
(LazyClassDescriptor) and are deserialized from binaries
(EnumEntrySyntheticClassDescriptor) are the same. There are tests on
incremental compilation in JS that check that the serialized proto is
exactly the same after rebuild and after an incremental build.

 #KT-22048 Fixed
2018-07-02 18:49:08 +02:00
Denis Zharkov 3b968351bb Load Java overrides of Kotlin suspend functions as suspend, too
There's still some blind spots:
- Covariant overrides in Java (KT-25036)
- Current implementation assumes that when language version is 1.3 every suspend function
reference only release-coroutines-package Continuation
(we need to check if it's a correct statement)

 #KT-24848 Fixed
 #KT-25036 Open
2018-07-02 14:14:59 +03:00
Dmitry Petrov 92430fc63a Update testData for JS_IR tests 2018-06-29 14:23:09 +03:00
Zalim Bashorov 56bf1f895c Mute failed test for JS IR BE
(cherry picked from commit 6d379a6)
2018-06-29 11:24:46 +03:00
Mikhael Bogdanov b1693acfcd Unmute smap test in ir 2018-06-28 17:12:09 +02:00
Mikhael Bogdanov e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Dmitry Petrov 46a3f7420c When in debugger context, access private companion object directly 2018-06-26 16:46:55 +03:00
Alexander Udalov 1951d38f40 Retain optional expected annotations when compiling platform code
After this change, optional expected annotations will be compiled to
physical class files on JVM, and stored to metadata on other platforms,
to allow their usages from dependent platform modules. For example:

    @OptionalExpectation
    expect annotation class A

When compiling this code on JVM, A.class will be produced as if the
class A did neither have the 'expect' modifier, nor had it been
annotated with OptionalExpectation. Note that if there's no actual
annotation class for A, then usages (which can only be usages as
annotation entries) are simply skipped.

Class A will be public from Kotlin's point of view (since it should
be possible to use it in Kotlin sources), but _package-private_ in Java
to disallow its usages outside of the declaring module.

 #KT-18882 Fixed
 #KT-24617 Fixed
2018-06-26 10:23:55 +02:00
Mikhail Zarechenskiy ba6da7c40a Support varargs of inline class types with non-trivial spread
#KT-24880 In Progress
2018-06-25 17:15:50 +03:00