Commit Graph

54 Commits

Author SHA1 Message Date
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
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
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
Anton Bannykh
07b3b66fd9 JS IR: unmute tests 2018-07-10 13:34:19 +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
e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02: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
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
43e3314255 JS IR: Remove inline functions with reified type parameters
Otherwise we cannot handle type casts
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
Roman Artemev
6ac4fd2e5f [JS IR BE] Update test data 2018-06-14 19:54:30 +03:00
Anton Bannykh
675d02093d mute new test + regenerate tests 2018-06-09 19:59:19 +03:00
Anton Bannykh
96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Mikhail Zarechenskiy
d29f3fc3c5 Add test to check work of inline classes with callable references 2018-06-08 19:14:41 +03:00
Mikhail Zarechenskiy
cc19e4cd73 Refactoring: Move blackbox tests about unsigned types to new directory 2018-06-04 18:37:44 +03:00
Mikhail Zarechenskiy
5b5d9dd5a0 Allow unsigned integers overflow values of corresponding signed numbers 2018-06-04 18:37:40 +03:00
Mikhail Zarechenskiy
7d5fdb660d Treat number with unsigned literal as UByte & UShort & UInt & ULong 2018-06-04 18:37:36 +03:00
Mikhail Zarechenskiy
e5958d228a Introduce WITH_UNSIGNED directive to use unsigned types in tests 2018-06-04 18:19:30 +03:00
Mikhail Zarechenskiy
b25a1d9522 Support inline functions inside inline classes 2018-05-07 15:25:46 +03:00
Mikhail Zarechenskiy
5c57c799fc Fix generation of elvis with null constant for inline classes 2018-05-07 15:25:45 +03:00
Mikhail Zarechenskiy
f23b5103ec Avoid non-null assertions for inline classes based on nullable types
Note that there are more places where assertions for inline classes should refined:
  - lateinit vars
  - values that come from Java
  - type casts (interfaces to inline class type)
2018-02-20 14:41:48 +03:00
Mikhail Zarechenskiy
413e2d7fa1 Fix KotlinType of constructor call for inline classes 2018-02-20 11:58:18 +03:00
Mikhail Zarechenskiy
530dd01ca6 Fix unboxing values of inline class type from type parameters 2018-02-20 11:45:49 +03:00
Mikhail Zarechenskiy
e017e9cb5f Support passing inline class values with spread operator 2018-02-13 13:16:45 +03:00
Mikhail Zarechenskiy
3919dc94e1 Box values of inline class types when passing to function as varargs 2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
6687751cf5 Generate as check for inline classes using wrapper
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
a88dbefcd9 Generate is check for inline classes same as for primitives
Should be improved when inline class is based on non-null reference
2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy
d606e5bc89 Correct boxing for functional types containing inline classes 2018-02-13 13:16:43 +03:00
Mikhail Zarechenskiy
1d16d21dbb Fix boxing for non-local and labeled returns with inline classes 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy
80dd5c106e Propagate KotlinType through call generator, fix boxing on arguments 2018-02-13 13:16:42 +03:00
Mikhail Zarechenskiy
22b9c25dd0 Add KotlinType info about this inside inline class 2018-02-13 13:16:41 +03:00
Mikhail Zarechenskiy
c86d3e354b Skip call to the underlying value of inline class 2018-02-13 13:16:41 +03:00
Mikhail Zarechenskiy
ce601bebbe Fix detection of erased this for inline class 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
b361d0e9c0 Add test and check that iterator over UInt folds to a simple for-loop 2018-02-13 13:16:40 +03:00
Mikhail Zarechenskiy
059f1e9eed Support inline classes working with collection elements (get/set) 2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
8015295059 Desugar constructor call of inline class to the underlying value
Also add information about KotlinType to the constant stack values
2018-02-13 13:16:39 +03:00
Mikhail Zarechenskiy
913e4b42bb Support inline classes as last expression in lambda 2018-02-09 05:06:32 +03:00
Mikhail Zarechenskiy
396cc7d02b Support unboxing of inline classes in elvis 2018-02-09 05:06:31 +03:00
Mikhail Zarechenskiy
fefcddc803 Support boxing/unboxing for captured vars of inline class types 2018-02-09 05:06:29 +03:00
Mikhail Zarechenskiy
9f24bbd980 Support unboxing of inline classes after assertion operator 2018-02-09 05:06:27 +03:00
Mikhail Zarechenskiy
30c79ffadc Support generating computable properties inside inline classes 2018-02-09 04:57:20 +03:00
Mikhail Zarechenskiy
47aeeb36e4 Get accessors for companion object properties through wrapper class 2018-02-09 04:56:46 +03:00
Mikhail Zarechenskiy
c5c8d84719 Support boxing/unboxing for method return types 2018-02-09 04:56:36 +03:00