Commit Graph

2602 Commits

Author SHA1 Message Date
Stanislav Erokhin 2ceb8cef36 [NI] Use same ResolvedCall when run completion
It is necessary, because some clients store this ResolvedCall to other
places, for example for get call it stored to INDEXED_LVALUE_GET
2017-08-25 03:38:49 +03:00
Mikhail Zarechenskiy f31c48017b [NI] Don't process lambda until expected type will be fixed 2017-08-25 02:47:46 +03:00
Mikhail Zarechenskiy 3f8a685ace [NI] Make return type of !! operator definitely not-null 2017-08-24 13:50:11 +03:00
Mikhail Zarechenskiy d18a14b717 [NI] Eliminate special intersection type from result type 2017-08-24 13:50:10 +03:00
Mikhail Zarechenskiy 9f2bf066b9 [NI] Transform anonymous types of expected type for delegation 2017-08-24 13:50:09 +03:00
Mikhael Bogdanov 1a05df204e Properly check expression nullability on attempt to apply == optimizations
#Fix KT-19767
2017-08-24 09:51:55 +02:00
Mikhail Zarechenskiy c45f86a2fc [NI] Resolve function literals in block as lambda expression 2017-08-23 15:53:52 +03:00
Mikhail Zarechenskiy 08964006de [NI] Avoid type capturing for types that can contain type variables 2017-08-23 15:53:51 +03:00
Stanislav Erokhin 9f71de5f66 Add test for lambda as last expression in lambda 2017-08-23 15:53:45 +03:00
Stanislav Erokhin 74e07b6580 Add regression test for no resolution recursion 2017-08-23 15:53:44 +03:00
Denis Zharkov ad9fe53ee2 Avoid local var entry for continuation parameter in suspend function
The primary reason is getting rid of redundant stack spilling, but also
it's not very sensible to have such entry since the parameter
is synthetic
2017-08-22 18:43:31 +03:00
Denis Zharkov fcd7677a3f Fix compatibility of suspend functions with strict bytecode analyzers
In short, some of the bytecode analyzers assume that there could be
no stores instructions into parameter vars with value of different
types (even when the value type is a subtype)

See the issue for details

 #KT-19713 Fixed
2017-08-22 18:43:26 +03:00
Mikhael Bogdanov 8af7a25f8e Update maxStack on synthetic instruction insertion
#KT-19723 Fixed
2017-08-17 20:02:29 +02:00
Alexander Udalov 4d2fbf1801 Fix reflection for local delegated properties inside interface
#KT-19690
2017-08-17 15:35:11 +02:00
Mikhael Bogdanov 97d46e76f5 Use 'DefaultImpls' as owner for interface local delegated properties
#KT-19690 Fixed
2017-08-17 15:35:10 +02:00
Mikhael Bogdanov 79ecc7fd5c Don't recognize nullable function types as inlinable
#KT-19679 Fixed
2017-08-17 14:24:00 +02:00
Yan Zhulanow 57d209f599 Kapt: Do not use awkward ('$' -> '/') logic for KAPT3 class builder mode
So (for the most often reproduction case) #KT-19433 Fixed

Before this commit, internal names for nested classes were written as test/Foo/Bar (comparing to test/Foo$Bar in the normal mode), as getting qualified names from such internal names was trivial. But, because of IC, we needed to write class files to the disk, so our decompiler could find such "broken" classes and read it in a wrong way.
2017-08-15 17:48:51 +03:00
Mikhael Bogdanov 6ca06265cf Rename and disable test on JS 2017-08-10 16:16:28 +02:00
Mikhael Bogdanov 3fd6dd3572 Add test for quoted class name 2017-08-10 12:10:25 +02:00
Denis Zharkov ff0736f09e Fix exception after combination of while (true) + stack-spilling
FixStack transformation divides on phases:
- Fixing stack before break/continue
- Fixing stack for inline markers/try-catch blocks

After the first stage all ALWAYS_TRUE markers are replaced
with simple GOTO's and if we're skipping break/continue edges
we won't reach the code after while (true) statement.

At the same time it's fine to not to skip them in the second phase
as the stack for them is already corrected in the first phase

 #KT-19475 Fixed
2017-08-08 18:52:21 +07:00
Denis Zharkov 45d5f6a950 Add test for obsolete issue
#KT-19467 Obsolete
2017-08-08 18:52:21 +07:00
Mikhael Bogdanov 15f401a473 Copy annotation and attributes on class transformation during inline 2017-08-08 09:50:42 +02:00
Mikhail Zarechenskiy e7cd615450 [NI] Introduce type depth in CS calculator to avoid SOE 2017-08-07 18:01:13 +03:00
Mikhail Zarechenskiy cf75afba66 [NI] Fix type intersection for equal types 2017-08-07 18:01:12 +03:00
Mikhail Zarechenskiy 0d464f06d1 [NI] Consider CS as nullable if one of the types isn't subtype of Any
Note that this isn't fully correct, consider the following situation:

S : T, T : Any?
=> CS(S, T) = T, but for now it will be T?, which is reliable but not so specific as just T
2017-08-07 18:01:09 +03:00
Mikhail Zarechenskiy 39349abd39 [NI] Preserve name of parameters for functional types 2017-08-07 18:01:07 +03:00
Stanislav Erokhin d58c6e245f Minor. rename type parameters for debug purposes. 2017-08-07 18:00:43 +03:00
Dmitry Petrov 756f7d6e9c [NI] Fix tests (was a type checker bug, see KT-18380) 2017-08-07 18:00:38 +03:00
Dmitry Petrov 6facdcb7ea Minor: lambda arguments formatting 2017-08-07 18:00:20 +03:00
Dmitry Petrov f637ebe9ff Minor: formatting for lambda arguments 2017-08-07 18:00:14 +03:00
Dmitry Petrov 2ed5a5e368 'when' should use intrinsics for '=='
#KT-19029 Fixed Target versions 1.1.5
 #KT-18818 Fixed Target versions 1.1.5
2017-08-07 10:31:02 +03:00
Dmitry Petrov c5613888eb Look into proper context when generating backing field access
Problem manifests when a class property name matches a companion object
property name, and class property is referenced in closure context.

 #KT-19367 Fixed Target versions 1.1.5
2017-08-02 11:24:35 +03:00
Dmitry Petrov 9e6b706a03 Unwrap property imported from object on property access
#KT-18982 Fixed Target versions 1.1.5
2017-07-28 17:01:04 +03:00
Dmitry Petrov 67336653e0 Generate SAM wrappers only if they are required for a given argument
SAM interface wrapper for an argument is required,
if in the function descriptor for SAM adapter
type for the corresponding value parameter
doesn't match type of the corresponding value parameter
in the original (Java) descriptor.

 #KT-19251 Fixed Target versions 1.1.5
2017-07-28 08:24:46 +03:00
Dmitry Petrov 5df461c7e0 Add test for KT-19246
The issue was fixed by
https://github.com/jetbrains/kotlin/commit/904c7f9c640ccb38c0becb40bd3b5dad3ac921bd
2017-07-28 08:24:46 +03:00
Dmitry Petrov b81ca31aae Record resolved delegation call for primary ctor if single result
Do the same thing as for secondary constructor (looks like it was a
workaround for R&I bug that was used only for secondary constructors
for some reason).

 #KT-17464 Fixed Target versions 1.1.5
2017-07-27 09:24:48 +03:00
Dmitry Petrov c9ad290ad5 Do not store null for temporary in destructuring assignment
#KT-19256 Fixed Target versions 1.1.5
2017-07-27 09:02:26 +03:00
Dmitry Petrov b867c46f72 Generate for-in-range loop as counter loop when possible
If an upper bound is a compile-time constant != Int.MAX_VALUE,
we can generate 'for (i in x..N)' as 'for (i in x until N+1)'.
2017-07-27 09:02:26 +03:00
Mikhael Bogdanov ff676c050f Properly generate inner classes when compiling source for inline
KT-19175: Compiler generates different bytecode when classes are compiled separately or together

 #KT-19175 Fixed
2017-07-26 20:31:14 +02:00
Dmitry Petrov f558b4238c Use counter loop in intrinsic array constructors
#KT-19149 Fixed Target versions 1.1.5
2017-07-24 10:17:30 +03:00
Dmitry Petrov fda89e9c72 Add test for KT-19128
It looks like the problem was caused by incorrect merging of
StrictBasicValues and was fixed by commit
904c7f9c64.

 #KT-19128 Fixed
2017-07-24 10:15:27 +03:00
Dmitry Petrov d0c8af5621 Keep track of second receiver type in CallReceiver
#KT-17725 Fixed Target versions 1.1.5
2017-07-24 10:15:27 +03:00
Dmitry Petrov bf3e896464 Update 'this' extension receiver when there's a smart cast
If 'this' (implicit or explicit) was used as an extension receiver,
and the corresponding call required a smart-cast,
this information was effectively lost in "old" resolution & inference,
but is required by "old" JVM BE to generate proper CHECKCASTs.
2017-07-21 08:58:52 +03:00
Dmitry Petrov b4d8337ca5 Ignore test for 'primitive Char == object' in JS (KT-19081) 2017-07-21 08:52:29 +03:00
Dmitry Petrov e1a55e8dec Prefer compact bytecode for primitive/object comparisons with Boolean
'java.lang.Boolean#valueOf' doesn't allocate new objects
(it uses pre-allocated singletons for 'true' and 'false').
2017-07-21 08:52:29 +03:00
Dmitry Petrov 8e9c0294fe Do not box primitives for 'primitive == object'
NB user-defined 'equals' can violate contract for 'Object#equals', e.g.,
it can be asymmetric.
Thus we can't avoid boxing for 'object == primitive'.
2017-07-21 08:52:29 +03:00
Dmitry Petrov fa42f202fa Avoid boxing on 'primitive == boxed' when possible
Similar to 'boxed == primitive' case, different bytecode due to
evaluation order.
2017-07-21 08:52:29 +03:00
Dmitry Petrov e440de3494 Minor: GeneratePrimitiveVsObjectEqualityTestData 2017-07-21 08:52:29 +03:00
Dmitry Petrov 4cba600268 Minor: some more evaluation order tests for 'boxed == primitive' 2017-07-21 08:52:29 +03:00
Dmitry Petrov 81609e4c6f Generate complex equality comparison only when RHS can have side effects
In "short" version, LHS is always evaluated before RHS,
and RHS may be not evaluated if LHS is null.
So, it makes sense to use "short" version in cases when RHS can't have
side effects (because of more compact bytecode and more opportunities
for code elimination).
2017-07-21 08:52:29 +03:00