Commit Graph

58911 Commits

Author SHA1 Message Date
Nikolay Krasko b2a61eb5e6 Additional mute for IdeReplCompletionTestGenerated.testFunctions in 193 2019-11-07 20:23:29 +03:00
Nikolay Krasko 2aa251fd0c Remove deprecated API from InlayScratchFileRenderer 2019-11-07 20:23:28 +03:00
Vladimir Ilmov 9fb95e776e [HIGHLIGHT] Specific keyword rules for val,var highlighting.
'Kotlin keyword' rule configured as fallback rule for all Kotlin keywords:
- Created 'var'/'val' rules with fallback to 'Kotlin keyword'
- BUILTIN_ANNOTATION rule fallback changed from Java to 'Kotlin keyword'

 #KT-13344 Fixed
2019-11-07 18:48:59 +03:00
Dmitriy Dolovov 34ea47a868 Extract Konan Gradle model into a separate JAR file 2019-11-07 18:25:35 +03:00
pyos fb9f43c119 JVM_IR: fix load check in inliner (should accept primitives too) 2019-11-07 15:58:44 +01:00
Alexander Udalov 4164b620e8 Minor, remove obsolete directives and suppressions from contracts test data 2019-11-07 15:20:34 +01:00
Alexander Udalov 66e19b13ce IR: create shared variables for val-variables when needed
This is possible when a lambda's contract guarantees initialization of a
variable.
2019-11-07 15:20:34 +01:00
Igor Chevdar 5c4b47c336 [native-gradle-plugin] Disabled native daemon for tests for now 2019-11-07 17:01:18 +03:00
Igor Chevdar 83331a0afb [native-gradle-plugin] Test fix 2019-11-07 17:00:59 +03:00
Igor Chevdar ecb001d5db Bumped K/N version 2019-11-07 17:00:03 +03:00
Igor Chevdar d36effd725 [native-gradle-plugin] Run konan directly from the gradle process 2019-11-07 17:00:03 +03:00
Nikolay Krasko d755002ac4 Advance bootstrap to 1.3.70-dev-1231 2019-11-07 16:24:13 +03:00
Nikolay Krasko 0ea64c8d4b Avoid using js dist library during jps build as it absent in bootstrap 2019-11-07 16:24:13 +03:00
Nikolay Krasko 155a760ee9 Revert "Revert [JS IR] commits that failed build"
This reverts commit 740f851a
2019-11-07 16:24:13 +03:00
Steven Schäfer 181d023e3c JVM IR: Remove JvmBackendContext.getTopLevelClass 2019-11-07 13:48:43 +01:00
Steven Schäfer 1ac753602e JVM IR: Avoid getTopLevelClass in CollectionStubMethodLowering 2019-11-07 13:48:43 +01:00
Steven Schäfer f9ff3771e5 JVM IR: Avoid getTopLevelClass in AddContinuationLowering 2019-11-07 13:48:43 +01:00
Steven Schäfer 481d4d72b9 JVM IR: Avoid getTopLevelClass in JvmSymbols 2019-11-07 13:48:43 +01:00
Mark Punzalan d0c261c779 Ensure the correct functions (with correct params) are being used in
ForLoopsLowering.
2019-11-07 13:43:24 +01:00
Mark Punzalan 21178a4f1a Fix issue getting the size property from Collection bounded type
parameters, when lowering for-loops over Collection.indices.
2019-11-07 13:43:24 +01:00
Mikhail Glukhikh 30679ebfaf FIR Java: implement correct type matching in SuperTypeScope 2019-11-07 15:07:41 +03:00
Ilya Kirillov 7fffd3d0f2 Fix using method removed from 193 in old J2K 2019-11-07 14:59:08 +03:00
Toshiaki Kameyama 39db76b2ab "Indent raw string" intention: do not suggest in const
#KT-34784 Fixed
2019-11-07 14:57:56 +03:00
Georgy Bronnikov 688a2185fa Tests for Kapt3 with JVM_IR backend 2019-11-07 13:28:09 +03:00
Mikhail Glukhikh 4d9839a790 JavaClassUseSiteMemberScope: add mutable vs non-mutable type matching 2019-11-07 13:08:38 +03:00
Dmitriy Novozhilov 61c337588b Revert testdata accidentally committed in 665405c4 2019-11-07 10:41:15 +03:00
Dmitriy Novozhilov 4f8a8f84ba [FIR] Update some testdata in fir visualizer test 2019-11-07 10:39:22 +03:00
Dmitriy Novozhilov abf41f87a1 [FIR] Fix rendering of local variables in Visualizer 2019-11-07 10:39:21 +03:00
Dmitriy Novozhilov f0ba9c3c40 [FIR] Make file separator in AbstractVisualizer OS independent 2019-11-07 10:39:21 +03:00
Mikhail Glukhikh 581504aac5 Raw FIR: add synthesized Enum.values() function #KT-24076 Fixed 2019-11-07 09:29:00 +03:00
Mikhail Glukhikh 6e0148c7a8 FIR: cleanup of DataClassUtils: remove redundant status field assignments 2019-11-07 09:28:16 +03:00
Leonid Startsev 3b100e57f2 Change NO_EXPLICIT_VISIBILITY_IN_API_MODE diagnostic range to 'declaration modifiers + name'.
Motivation: missing visibility modifier is an error in visibility modifiers list, so we should highlight this list.
Including a name in the range is convenient for using alt+enter (you don't have to move cursor from name to fun/class/val keyword)

 Also change NO_EXPLICIT_RETURN_TYPE_IN_API_MODE diagnostic range to 'declaration name' to match corresponding IDE inspection.

Fix stylistic problems and typos after review
2019-11-06 19:54:00 +03:00
Leonid Startsev 24688f3503 Do not disable 'redundant visibility modifier' inspection completely in Explicit API mode.
Instead, disable it only for effectively public declarations.

Add tests for this IDE inspection.
2019-11-06 19:54:00 +03:00
Leonid Startsev 5ab262c977 Skip explicit API inspection for data class properties and add inspection for public API in interfaces
Add tests for almost all the cases
2019-11-06 19:54:00 +03:00
Leonid Startsev ebb7e434c8 Explicit Api mode: Renamings after design discussions
Change CLI flag to -Xexplicit-api=strict|warning. 'Disable' state and 'mode' suffix are left out as implementation details.

Change intention title to 'make X public explicitly'

Do not report 'no explicit visibility' on property accessors

Set DECLARATION_SIGNATURE as a range for report

Rename internal diagnostic from _MIGRATION to _WARNING
2019-11-06 19:53:59 +03:00
Leonid Startsev 7fada51c42 Add quickfix for setting explicit public visibility for diagnostic reported in API mode 2019-11-06 19:53:59 +03:00
Leonid Startsev 2b708093c0 Add explicit return type check for API mode
It will use the same SpecifyTypeExplicitlyIntention as in other places; to reuse check logic, some parts of code were moved from corresponding inspection (PublicApiImplicitTypeInspection) into ApiModeDeclarationChecker.

Also disable RedundantVisibilityModifierInspection when API mode is on.
2019-11-06 19:53:58 +03:00
Leonid Startsev 7058492b55 Explicit Api mode: prototype with check for missing explicit visibility
Add cli flag with 3-state switch
2019-11-06 19:53:58 +03:00
Alexander Udalov a7d60fbf2d JVM IR: minor, fix IR builder scope for multifile bridges 2019-11-06 17:05:49 +01:00
Alexander Udalov 7a2c467bb5 JVM IR: remove obsolete hack in JvmMultifileClass facade generation 2019-11-06 17:05:49 +01:00
pyos 5d8aac456f JVM_IR: create temporaries for complex super constructor arguments
As for SAM wrappers, the bytecode sequence

    new A
    dup
    new B
    dup
    invokespecial B.<init>
    invokespecial A.<init>

breaks the inliner, so instead we do

    new B
    dup
    invokespecial B.<init>
    store x
    new A
    dup
    load x
    invokespecial A.<init>
2019-11-06 15:54:40 +01:00
pyos 42f75b3247 JVM_IR: have SAM wrapper constructors accept FunctionN
Otherwise, the cached instances cannot be reused for different wrapped
types. Also, if the wrapped type is regenerated during inlining, the
inliner would produce a call to a nonexistent constructor that takes the
regenerated type as an argument.
2019-11-06 15:54:40 +01:00
pyos 862197d713 JVM_IR: create temporaries for complex SAM conversion arguments
To avoid bytecode sequences like

    new _1Kt$sam$i$java_lang_Runnable$0
    dup
    new _1Kt$f$1
    dup
    invokespecial _1Kt$f$1.<init>()V
    invokespecial _1Kt$sam$i$java_lang_Runnable$0.<init>(...)V

as the different order of `new` and `<init>` confuses the inliner.
2019-11-06 15:54:40 +01:00
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