Commit Graph

12 Commits

Author SHA1 Message Date
Dmitry Petrov
8054e2960e PSI2IR: Post-process return expressions based on expected return type
Consider the following example:

Java:
  public class J {
    public static String foo() { return null; }
  }

Kotlin:
  fun check(fn: () -> Any) = fn()
  fun test() = check { J.foo() }

When a lambda expression returns a value of platform type ('String!'),
corresponding lambda has platform type in its return type, which is
approximated to corresponding nullable type ('String?') in IR.
However, the lambda itself could occur in position with a functional
expected type ('() -> Any'). This implies an extra implicit cast on a
return value of lambda expression ('J.foo()'), although it conforms to
the return type of lambda.
2019-12-31 13:30:23 +03:00
Dmitry Petrov
d622542824 PSI2IR: Fix delegated members generation
When generating bodies for members implemented by delegation, invoke
corresponding delegate member, not an interface member. Otherwise we
might lose platform-specific nullability information in case of mixed
Kotlin-Java hierarchies, as in
implicitNotNullOnDelegatedImplementation.kt
2019-12-30 18:36:16 +03:00
Dmitry Petrov
f6b99955f8 Update testData in bytecodeText (argument nullability assertions) 2019-12-06 11:03:07 +03:00
Steven Schäfer
da8fb3a195 JVM_IR: Respect -Xno-param-assertions 2019-07-08 17:48:33 +02:00
Steven Schäfer
dd20b74030 Split GenerateNotNullAssertionsTests into standard box and bytecode tests 2019-07-08 17:48:33 +02:00
Alexander Udalov
cb7727d51a Add explicit WITH_RUNTIME to boxAgainstJava tests which need stdlib 2019-03-28 14:26:10 +01:00
Mikhael Bogdanov
34a12cb87c Mute 'boxAgainstJava' tests 2018-08-02 13:19:27 +02:00
Alexander Udalov
280ad195ee Migrate boxAgainstJava tests to multi-file framework 2016-03-02 15:47:36 +03:00
Ilya Gorbunov
25c4453dc5 Cleanup deprecated symbol usages in testData 2016-01-22 05:54:38 +03:00
Denis Zharkov
3ec00114c0 Check type of elvis with expected type info
#KT-6713
2015-07-21 15:16:06 +03:00
Dmitry Jemerov
4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Andrey Breslav
a737352b5d Assertions when approximating platform types in delegation by expression 2014-10-13 15:38:13 +04:00