Commit Graph

60369 Commits

Author SHA1 Message Date
Mikhael Bogdanov 2ed0cb2a89 Support type annotations
#KT-35843 Fixed
2020-01-09 14:00:11 +01:00
Alexander Udalov fde9b21a40 Fix syntheticMethodForProperty.kt for JDK 9+ and Android tests 2020-01-09 11:34:51 +01:00
Dmitriy Dolovov 5803fcdeb4 Bugfix: KotlinIdeaResolutionException on absent/corrupted KLIB artifact
Issue #KT-35839
2020-01-09 17:13:54 +07:00
Ilya Chernikov 995c6a32b8 Allow only single expression eval in cli compiler and kotlin runner
#KT-35740 fixed
also add tests and drop logger usage in the cli dependencies manager:
the logger is normally unitialized in the usage scenarios, but related
warnings are annoying.
2020-01-09 10:51:25 +01:00
Dmitriy Dolovov 7ffb64ec57 Minor: formatted code 2020-01-09 16:01:22 +07:00
Dmitriy Dolovov e0d90ccf4b [Commonizer] Log commonization stats into a single file 2020-01-09 16:01:16 +07:00
Dmitriy Dolovov f18aa3e0be [Commonizer] Re-organize commonizer CLI 2020-01-09 16:01:09 +07:00
Dmitriy Dolovov 805ac2d307 [Commonizer] Re-organize utilities 2020-01-09 16:01:03 +07:00
Nicolay Mitropolsky ed4e73c8e9 Uast: the returnType support for light methods for reified functions (KT-35610) 2020-01-09 11:55:22 +03:00
Nicolay Mitropolsky c04ba009e6 Uast: properly handling annotations on destructured variables (KT-35673, EA-220128) 2020-01-09 11:55:22 +03:00
Ilya Chernikov 9da536c202 [minor] "fix" fir testdata for KT-30245 test, todo: fix problems in fir accordingly 2020-01-09 08:08:45 +01:00
Ilya Chernikov caa677e6d2 [NI] Convert extension lambda to the non-extension one, if needed
#KT-30245 fixed
2020-01-09 08:08:45 +01:00
pyos ef5fe0675a JVM_IR: refactor suspendFunctionView
fixing the check for DescriptorWithContainerSource in the process
(containerSource *may* be null).
2020-01-08 19:52:20 +01:00
Mark Punzalan 137ef26723 [JVM IR] Fix issue with destructuring declaration in parameter for
suspend lambda.

The Name for the special destructuring declaration parameter was
incorrectly turned into a regular/non-special Name when the parameter
was moved to a field.
2020-01-08 19:51:16 +01:00
Mark Punzalan 36c4df6d99 [JVM IR] Use names of local functions in names of local classes.
This undoes changes in
https://github.com/JetBrains/kotlin/commit/fbe66c3496d082d2d487b2c39673f0cd4ac5b70a
which broke calculation of the simple name of local classes in
reflection (the enclosing method was not a substring of the name of the
local class).
2020-01-08 18:45:40 +01:00
Mark Punzalan 70b304e6e4 [JVM IR] Support target templates in
AbstractCheckLocalVariablesTableTest and fix
`checkLocalVariablesTable/localFun.kt` for JVM IR.

Also improved diagnosability of CheckLocalVariablesTableTest failures.
2020-01-08 18:45:40 +01:00
Alexander Udalov 152d88e747 Mute generated FIR tests after 929fb5c8 2020-01-08 18:06:07 +01:00
Steven Schäfer 929fb5c82b Mute FIR tests containing broken function calls 2020-01-08 13:20:00 +01:00
Steven Schäfer 5309e774ac JVM IR: Remove FAKE_OWNER from MethodSignatureMapper
FAKE_OWNER is a hack for when we encounter IrFunctions with non-class
parents during codegen. This can only happen for unhandled intrinsic
functions and resolving them to FAKE_OWNER can cause codegen to succeed
while producing broken bytecode.
2020-01-08 13:20:00 +01:00
Steven Schäfer 5ffbf9264a JVM IR: Implement the enumValues and enumValueOf intrinsics
These were previously handled in the inliner.
2020-01-08 13:20:00 +01:00
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