Commit Graph

60349 Commits

Author SHA1 Message Date
Steven Schäfer bd74e976c9 JVM IR: Lower calls to the emptyArray intrinsic in VarargLowering
There are two array intrinsics which are handled in the inliner on the
JVM backend: arrayOf and emptyArray. In the IR backend we are already
lowering arrayOf as part of VarargLowering and this commit adds support
for lowering emptyArray as well.
2020-01-08 13:20:00 +01:00
Mads Ager 1b1dff9191 JVM_IR: fix default argument stub visibility.
Match the rules from the old backend:

1. Private and inline only methods get package private default
   argument stubs.

2. Everything else is public.
2020-01-08 13:19:14 +01:00
Steven Schäfer 7f319c18de JVM IR: Mark Enum.$VALUES field as synthetic (#2957) 2020-01-08 13:17:58 +01:00
pyos 6b5d92a693 IR: work around a bug in interface delegation descriptors
interface I {
        fun f(x: Int = 1)
    }
    class C(val y: I) : I by y {
        // implicit `override fun f(x: Int) = y.f(x)` has a default value for `x`
    }

-- the only case where a function with overridden symbols has defaults.
2020-01-03 17:09:31 +01:00
Mads Ager 98f5c5aa95 JVM_IR: Preserve annotations on inline class replacement methods. 2020-01-03 16:44:50 +01:00
Mads Ager e7835fecfc JVM_IR: fix a couple of inline class reflection issues.
1. Postpone the computation of the signature for property
   reference getters for extension properties until codegen time.

2. Generate metadata for static replacement functions instead
   of the original functions.
2020-01-03 16:38:53 +01:00
Mads Ager 2ebb797e61 JVM_IR: Remove accessor for internal inline class properties. 2020-01-03 15:29:34 +01:00
Dmitry Petrov d27593aeda PSI2IR: SAM conversion in method arguments of out-projected Java classes
It uses the same logic as an old back-end
(see SamType#createByValueParameter and genericSamProjectedOut.kt),
split into two parts:

1. When inserting SAM casts, use SamType#createByValueParamerer to get
the target SAM type.

2. When inserting implicit casts, cast SAM conversions as arguments of
methods of out-projected types to the original type of value parameter
instead of 'Nothing'.
2020-01-03 15:32:44 +03:00
Alexander Udalov a55bce801e Update year in the license to 2020 2020-01-03 13:09:43 +01:00
Alexander Udalov e0b9ffa780 Regenerate builtins sources 2020-01-03 13:09:43 +01:00
Alexander Udalov d73e6c855b Regenerate FIR tree 2020-01-02 10:59:24 +01:00
Alexander Udalov 8a4510c21b Regenerate tests 2020-01-02 10:31:00 +01:00
Vyacheslav Gerasimov a55296db26 Mute flaky GradleKtsImportTest.testCompositeBuild 2019-12-31 17:11:09 +03:00
Vyacheslav Gerasimov 1b00996c86 Mute failing test-kotlin-version-in-manifest
Should be unmuted after #KT-35776 is fixed
2019-12-31 16:37:14 +03:00
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 0e4e5ac287 Update nullability assertion tests that use newer Java features 2019-12-31 11:14:52 +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
Alexander Udalov cc0b231b3b Convert SyntheticMethodForAnnotatedPropertyGenTest to a box test 2019-12-30 16:30:50 +01:00
Alexander Udalov 8f30b25b24 Minor, fix some codegen tests for language version 1.4
These tests check behavior of an old language version on purpose: the
original bug KT-24708 has been fixed by introducing an error here in
1.4.
2019-12-30 16:30:45 +01:00
Alexander Udalov e2a42446ed Use getter names for $annotations methods in most codegen tests
This is needed to update master to 1.4, while still testing the latest
compiler by default. Also add one test on the old behavior.
2019-12-30 16:29:13 +01:00
Dmitry Petrov 330dd789de Minor: mute test in FIR+JVM_IR 2019-12-30 16:08:44 +03:00
Nikolay Krasko c7d39b612c Simplify adding Kotlin sdk by inlining internals of ProjectSdksModel
Because of using cloning sdks inside ProjectSdksModel tests fail with sdk leaked errors.
2019-12-30 13:50:12 +03:00
Nikolay Krasko 70067bc9bf Better fix for compiler plugin test initialization
The previous one didn't work in 191.
Also revert changes in tests-common module.
2019-12-30 13:22:34 +03:00
Simon Ogorodnik 1715f1a864 [FIR] Refactoring: create use-site scopes via scope provider 2019-12-30 12:52:58 +03:00
Mikhail Glukhikh 5f08fe88a5 [FIR] Move ScopeSession to fir:tree 2019-12-30 12:52:53 +03:00
Dmitry Petrov 98bf0e278f Fix problem with empty vararg of boxed primitives in JVM_IR
When calling a generic Java generic method with vararg parameters with empty
vararg, incorrect array creation instruction was generated for primitive type:
NEWARRAY T_INT instead of ANEWARRAY java/lang/Integer. Here for Java method

  public static <T> void takesVarargOfT(T x1, T... xs) {}

corresponding vararg parameter was considered to be of type 'Array<T>?',
which is not a non-null array type, so, NewArray intrinsic failed to generate
proper bytecode.
2019-12-30 11:26:21 +03:00
Dmitry Petrov 0667ee9796 Minor: optimize imports 2019-12-30 11:26:21 +03:00
Dmitry Petrov 76e7a9ba4a Generate instructions as text in case of other exceptions
It makes possible to analyze what causes a failure if DxChecker.check fails
2019-12-30 11:26:21 +03:00
Mikhael Bogdanov 4b6202c902 JVM_IR. Support inlining of bound CR 2019-12-30 08:35:46 +01:00
Roman Golyshev 42deb7db48 KT-34582 Exclude kotlin.coroutines.experimental package from completion and auto-import
- Exclusion happens only when `ReleaseCoroutines` feature is supported
- Add `LANGUAGE_VERSION` to few tests to make sure that previous exclusions still work when `experimental` package is not excluded entirely
- ^KT-34582 Fixed
2019-12-29 15:35:49 +03:00
Pavel Kirpichenkov 8399614de8 Move muted test failing on all platforms to mute-common
KT-35728
2019-12-28 13:18:00 +03:00
Ilya Gorbunov a98f36bce4 Reorganize existing Closeable/AutoCloseable.use tests 2019-12-28 03:02:01 +03:00
Toshiaki Kameyama 941de655c4 Add contract for 'use'
#KT-35216 Fixed
2019-12-28 02:54:29 +03:00
Ilya Gorbunov 043eddb432 Cleanup: use effects introduced by contracts of assert* functions 2019-12-28 02:51:56 +03:00
Zalim Bashorov 04fe0dc795 Minor: enable commit message inspections in IDEA 2019-12-27 22:34:02 +03:00
Zalim Bashorov 9cf1a2b404 [Build] Remove the property to skip JS IR BE tests
It's no longer needed since we going to start building libraries using the new BE,
so we have to be sure that everything works well in releases branches too.
2019-12-27 22:34:02 +03:00
Zalim Bashorov 9557034cf7 [Build] Mark tmp dir in the root of project as excluded 2019-12-27 22:34:02 +03:00
Pavel Kirpichenkov 40812cd116 Mute quickfix test (KT-35728) 2019-12-27 19:01:32 +03:00
Pavel Kirpichenkov 2d21b82501 [NI] Remove hack for special functions
Treating special functions for `if`, `when`, `try`, `?:` as not accepting `Nothing` result type is incorrect.
Making so leads to cases with uninferred `Nothing` result type for inner calls and lost data flow info.
2019-12-27 18:40:42 +03:00
Alexander Gorshenev 9a12641fde Allow parallel access to klib zip filesystem 2019-12-27 18:19:48 +03:00
Nikolay Krasko ddda93ad96 Mute flaky JavaAgainstKotlin.testUsingMutableInterfaces 2019-12-27 16:53:21 +03:00
Nikolay Krasko e20c66011a Enable mute tests feature for BuiltInDecompilerTest 2019-12-27 16:53:20 +03:00
Nikolay Krasko 28e23f0aa8 Mute flaky step over tests on Android Studio 2019-12-27 16:53:20 +03:00
Nikolay Krasko 11e4b710b5 Mute GradleMigrateTest.testMigrateStdlib in AS 2019-12-27 16:53:19 +03:00
Nikolay Krasko 77edfed764 Mute tests for preferring JDK classes in completion and auto-import in 191 and 192 (KT-35709)
BasicCompletionWeigherTestGenerated.testPreferFromJdk
AutoImports.testAmbiguousNamePreferFromJdk
2019-12-27 16:53:19 +03:00
Nikolay Krasko 74e2c98426 Fix test data for QuickFixTestGenerated.SupertypeInitialization in 191 2019-12-27 16:53:19 +03:00
Nikolay Krasko 0d48855333 Mute JavaToKotlinConverterSingleFileTestGenerated in 191 2019-12-27 16:53:18 +03:00
Nikolay Krasko 28eb6a223d Fix UpdateConfigurationQuickFixTest.testEnableCoroutinesFacet test 2019-12-27 16:53:18 +03:00
Nikolay Krasko 4c28e0dec3 Split tests to common and platform parts 2019-12-27 16:53:17 +03:00
Nikolay Krasko 570b522e8e Minor: sort tests in mute database 2019-12-27 16:53:17 +03:00