Commit Graph

58868 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy 650e2501bb [NI] Prioritize variables with trivial constraints over complex ones
Consider the following constraint system (from the test example):

Nothing? <: V1
F!! <: V2
Inv<V1> <: S
Inv<V2> <: S

Where V1, V2, S are type variables, and F has nullable upper bound.
Type variable fixation order should be: V2 -> V1 -> S, and the problem
was that previously after fixation of type variable V2 we were trying
to fix S (before V1), so we had the following constraints on S:
Inv<F!!> <: S
Inv<V1> <: S
=> S were fixed to Inv<F!!>

And after this V1 was fixed to F!! which is contradictory as Nothing?
is not a subtype of F!!.

 #KT-33033 Fixed
2019-11-06 15:20:17 +03:00
Mikhail Zarechenskiy 5582fd4056 [NI] Discard DefNotNull types inside invariant positions
#KT-30297 Fixed
 #KT-32168 Fixed
 #KT-27722 Fixed (actually, it was fixed with addition of DefNotNullTypes, and now test was added to save this behavior)
 #KT-32345 Fixed
2019-11-06 15:20:17 +03:00
pyos 4fc1bd9ec5 Support inlining functions with KT-28064 style objects
Namely, anonymous objects defined in lambdas that have all captured
variables as loose fields instead of a single reference to the parent.

The question is, when a lambda inside an inline function defines an
anonymous object, and that object is not regenerated during codegen for
the inline function itself, but then has to be regenerated at call site
anyway, do we use an outer `this` or loose capture fields? For example,
before KT-28064:

    inline fun f1(g: () -> Unit) = object { g() }
    // -> f1$1 { $g: () -> Unit }
    inline fun f2(g: () -> Unit) = f1 { object { g() } }
    // -> f2$$inlined$f1$1 { $g: () -> Unit }
    //    f2$$inlined$f1$1$lambda$1 { this$0: f2$$inlined$f1$1 }
    inline fun f3(g: () -> Unit) = f2 { object { g() } }
    // -> f3$$inlined$f2$1 { $g: () -> Unit }
    //    f3$$inlined$f2$1$1 { this$0: f3$$inlined$f2$1 }
    //    f3$$inlined$f2$1$1$lambda$1 { this$0: f3$$inlined$f2$1$1 }

After KT-28064:

    inline fun f2(g: () -> Unit) = f1 { object { g() } }
    // -> f2$$inlined$f1$1 { $g: () -> Unit }
    //    f2$1$1 { $g: () -> Unit }
    inline fun f3(g: () -> Unit) = f2 { object { g() } }
    // -> f3$$inlined$f2$1 { $g: () -> Unit }
    //    f3$$inlined$f2$2 { ??? }
    //    f3$1$1 { $g: () -> Unit }

Should `???` be `this$0: f3$$inlined$f2$1` or `$g: () -> Unit`? This
commit chooses the latter for KT-28064 bytecode and keeps `this$0` when
inlining the old bytecode.
2019-11-06 13:11:44 +01:00
Dmitriy Novozhilov 27e1a54d4e [FIR] Add descriptors.runtime as dependency to psi2fir test 2019-11-06 15:05:06 +03:00
Dmitriy Novozhilov 665405c435 [FIR] Add discriminating generics into ConeOverloadConflictResolver 2019-11-06 15:05:06 +03:00
Mikhail Zarechenskiy 86a8412b05 Don't try loading PSI tree in IDE mode via stubs (e.g. decompiled code)
Here we want getting trailing comma in order to check its correctness
  and then to report diagnostics. Now, note that if we have stub for
  some PSI element, it means that we're definitely not in the compiler as
  there are no stubs and we're definitely not in the current source file,
  because in the current file we have full PSI tree in IDE.

  Stubs are required, for example, for decompiled code and there is no
  need to report any diagnostics about trailing comma there.

  Also, because we don't have stubs for destructuring declarations,
  one check for trailing commas is left without similar guard (
  see resolveLocalVariablesFromDestructuringDeclaration method)

  This commit fixes several IDE-tests:
   MultiFileJvmBasicCompletionTestGenerated.testDoNotCompleteWithConstraints
   MultiFileJvmBasicCompletionTestGenerated.testInImport
   MultiFileJvmBasicCompletionTestGenerated.testInImportedFunctionLiteralParameter
   MultiFileJvmBasicCompletionTestGenerated.testMoreSpecificExtensionGeneric
   MultiFileJvmBasicCompletionTestGenerated.testNoGenericFunDuplication
   MultiFileJvmBasicCompletionTestGenerated.testNotImportedExtensionFunction2
2019-11-06 14:32:09 +03:00
Mikhail Glukhikh aff9ae2ecf FIR resolve bench: collect unique problems also from callee, ignore empty problems 2019-11-06 14:04:24 +03:00
Mikhail Glukhikh bd1127cfa3 FIR: resolve lambda arguments even if an outer call is unresolved 2019-11-06 13:19:20 +03:00
Mikhail Glukhikh 3b4edb3901 Don't recreate FirSpecificTypeResolverTransformer during type resolve stage 2019-11-06 13:19:20 +03:00
Mikhail Glukhikh 3dd3421437 Temporary: resolve type to kotlin/reflect/Function instead of kotlin/Function
This arises in callable reference resolve test due to incorrect fictitious symbols caching
2019-11-06 13:19:19 +03:00
Mikhail Glukhikh 60e6d2e521 Resolve local declaration statuses & types inside bodies in FirBodyResolveTransformer 2019-11-06 13:19:10 +03:00
Mikhail Glukhikh 668a2a58be FIR: switch off body visiting in status & type resolve transformers (breaks many tests) 2019-11-06 13:19:09 +03:00
Mikhail Glukhikh d6daf321a2 FIR: render implicit built-in type references as resolved ones 2019-11-06 13:19:08 +03:00
Alexander Udalov 7f4b568021 Mark new KClass.cast/safeCast extensions as low-priority
To avoid overload resolution ambiguity error in sources where everything
from both kotlin.reflect and kotlin.reflect.full is imported with a
star-import
2019-11-05 19:34:06 +01:00
Nikolay Krasko 3c7b0e6ccc Fix gradle runtime dependency issue for completion-ranking-kotlin library
Execution failed for task ':idea:idea-test-framework:test'.
> Could not resolve all files for configuration ':idea:idea-test-framework:testRuntimeClasspath'.
   > Could not find org.jetbrains.intellij.deps.completion:completion-ranking-kotlin:0.0.2.
...
        Required by:
            project :idea:idea-test-framework > project :idea

It looks like when resolving this dependency gradle doesn't check the list of repositories in :idea module.
2019-11-05 20:13:30 +03:00
Nikolay Krasko 279deb3a78 Mention navigation fails asserts in 193 in common file (KT-34542) 2019-11-05 20:13:30 +03:00
Nikolay Krasko 5ca3698d13 Remute JoinLinesTestGenerated tests in 193 (KT-34408) 2019-11-05 20:13:30 +03:00
Nikolay Krasko 651a70ae54 Remute MultiLineStringIndentTestGenerated tests in 193 (KT-34566) 2019-11-05 20:13:30 +03:00
Nikolay Krasko c50e60f90f More mutes for 193 branch
One more test for KT-34689.
2019-11-05 20:13:30 +03:00
Nikolay Krasko 5d19b2c3c4 Allow to mute tests with spaces in names 2019-11-05 20:13:30 +03:00
Alexander Podkhalyuzin e3c6a1fbd8 Updating progress for optimize imports
#KT-33905 Fixed
2019-11-05 18:10:06 +03:00
Alexander Podkhalyuzin d2ae39489f SmartPointers in Smart Completion for anonymous object generation
#KT-32615 Fixed
2019-11-05 17:51:34 +03:00
Dmitry Gridin d321f4626f Formatter: fix line break before OperationReference in elvis
#KT-22362 Fixed
2019-11-05 20:13:11 +07:00
Dmitry Gridin 247619c565 Formatter: fix line break between label and property
#KT-22273 Fixed
2019-11-05 20:13:11 +07:00
Dmitry Gridin 7f1935b82e formatter: cleanup code 2019-11-05 20:13:11 +07:00
Dmitry Gridin 0098588a6b NodeIndentStrategy: remove code duplication 2019-11-05 20:13:11 +07:00
Dmitry Gridin 196dd25637 ProjectCodeStyleImporter: fix deprecated elements 2019-11-05 20:13:11 +07:00
Mark Punzalan f2289c216c Fix type of IllegalArgumentException call for illegal step in StepHandler. 2019-11-05 14:04:56 +01:00
Dmitriy Novozhilov ca4784ffd3 Fix CLI testdata broken in 7f58162a 2019-11-05 15:41:35 +03:00
Dmitriy Novozhilov c58ca27b2e [FIR] Introduce ResolutionMode as data for body resolve instead of Any? 2019-11-05 15:22:23 +03:00
Dmitriy Novozhilov 7f58162abc Add -Xuse-mixed-named-arguments compiler flag
That flags enables MixedNamedArgumentsInTheirOwnPosition feature
  (see #KT-7745) without experimental warning
2019-11-05 15:22:23 +03:00
Dmitriy Novozhilov 23d492646d [FIR] Update testdata of SAM conversions diagnostics tests after lambda resolution fix 2019-11-05 15:22:23 +03:00
Dmitriy Novozhilov 010dae454e [FIR] Fix extracting parameters from extension function types 2019-11-05 15:22:23 +03:00
Dmitriy Novozhilov 9c8d6fb49b [FIR] Check for lambda arguments that expected type is functional type 2019-11-05 15:22:22 +03:00
Dmitriy Novozhilov 297d07f465 [FIR] Refactor fir resolve tests
Now there is only base test runner for all kinds of diagnostics test
  (`AbstractFirBaseDiagnosticsTest`)
2019-11-05 15:22:22 +03:00
Dmitriy Novozhilov 66abbe1aad [FIR] Fix testdata in fir diagnostic tests broken in 01f09af6 2019-11-05 15:22:22 +03:00
Steven Schäfer 704e6e96fa Fir2Ir: Produce IR_TEMPORARY_VARIABLE origins 2019-11-05 14:58:47 +03:00
Steven Schäfer 733c7579aa Normalize names of temporary variables in IrTextTests 2019-11-05 14:58:47 +03:00
Nikolay Krasko 740f851a10 Revert [JS IR] commits that failed build
Revert "[JS IR] Build hybrid versions of stdlib and kotlin.test"
This reverts commit b9f88350dd.

Revert "[JS IR] Add gradle plugin integration tests"
This reverts commit d872b27663.

Revert "Update bootstrap"
This reverts commit bc47594c7a.

Revert "[JS IR] Support generating both IR and pre-IR libraries"
This reverts commit 1b8df45bfe.
2019-11-05 13:58:39 +03:00
Alexander Podkhalyuzin 722f7ff056 Now using Kotlin setting instead of Java one 2019-11-05 11:57:08 +03:00
Alexander Udalov efaf779133 Minor, fix test data for kotlinx.serialization bytecode text test 2019-11-04 16:17:58 +01:00
Georgy Bronnikov 51459adb8c Add integration test for Kapt3+IR 2019-11-04 11:26:45 +03:00
Georgy Bronnikov 195f225e36 Run Kapt3 with old backend, even if IR is specified in configuration
Kapt does not currently work with IR backend. Temporarily switch to the
old JVM backend when running it.
2019-11-04 11:26:45 +03:00
Svyatoslav Kuzmich b9f88350dd [JS IR] Build hybrid versions of stdlib and kotlin.test
IR version of libraries are no published by default inside pre-IR JARs
2019-11-01 19:42:06 +03:00
Svyatoslav Kuzmich d872b27663 [JS IR] Add gradle plugin integration tests 2019-11-01 19:42:06 +03:00
Svyatoslav Kuzmich bc47594c7a Update bootstrap
New compiler arguments needed to publish JS IR libraries:
    - stdlib
    - kotlin-test
2019-11-01 19:42:06 +03:00
Svyatoslav Kuzmich 1b8df45bfe [JS IR] Support generating both IR and pre-IR libraries
Remove all previous -Xir options

Add:
 -Xir-produce-klib-dir
 -Xir-produce-klib-file
 -Xir-produce-js
 -Xir-only
2019-11-01 19:42:05 +03:00
victor.petukhov 62d204f4d6 Support trailing comma
^KT-34743 Fixed
2019-11-01 19:40:20 +03:00
LepilkinaElena e638b9fd12 K/N performance gradle plugin. Added options and right code size for … (#2752) 2019-11-01 18:16:43 +03:00
Ilmir Usmanov 8c079706a5 Add tests for case when result of tail-call suspend function returning
Unit is not Unit.
 #KT-34703 Fixed
2019-11-01 17:48:06 +03:00