Commit Graph

81054 Commits

Author SHA1 Message Date
Jinseong Jeon bb242f022f FIR renderer: avoid StackOverflow when rendering loop jump condition
For example,
```
do {
  ...
} while(
    when (...) {
      ... -> break
    }
)
```
That `break` condition is `when` expression, and while visiting its
branch result, we will see the same `break` again.
2021-04-01 20:07:52 +03:00
Jinseong Jeon b4a5eec5f4 Raw FIR: correct loop target for break/continue in do-while loop condition
As shown in KT-44412 (or KT-45319 or KT-17728):
```
fun test5() {
    var i = 0
    Outer@while (true) {
        ++i
        var j = 0
        Inner@do {
            ++j
        } while (if (j >= 3) false else break) // break@Inner
        if (i == 3) break
    }
}
```

To properly set the loop target for `break` in do-while loop condition,
the loop target for that do-while loop should be ready before parsing
the loop condition.

Previously, Raw FIR loop building configures loop target after visiting
loop conditions. This commit splits the configuration and lets the
builders prepare the loop target for do-while loop only.
2021-04-01 20:07:50 +03:00
Jinseong Jeon 81999117dc FIR2IR: force return type of loop body block as Unit 2021-04-01 20:07:49 +03:00
Jinseong Jeon 7898d167f3 FIR2IR: wrap do-while loop in IrBlock
"so that variables declared in loop body are not visible outside of the
loop" (from commit d096f1d)
2021-04-01 20:07:47 +03:00
Ilya Kirillov 08670114c8 Remove old j2k tests 2021-04-01 18:27:20 +02:00
Ilya Kirillov 9eb6b785c6 FIR IDE: encapsulate isInsideAnalysisContext check into ReadActionConfinementValidityTokenFactory 2021-04-01 18:26:40 +02:00
Ilya Kirillov 0d12110112 FIR IDE: introduce ValidityToken for light classes
To make all light classes stuff available from EDT
2021-04-01 18:26:39 +02:00
Stanislav Erokhin 8ffb822c3c Add way to create the FirAnalysisSession with custom token
This way should be used only for old FE wrappers.
It is important that Fir session with custom token should be cached,
because otherwise session with incorrect validity token could be
returned from cache inside analyze call
2021-04-01 18:26:38 +02:00
Ilya Kirillov 29bebae37d FIR IDE: add validity check of analysis component that it is valid only in analysis context 2021-04-01 18:26:38 +02:00
Ilya Kirillov bd38363077 FIR IDE: use IGNORE_FIR instead of FIR_COMPARISON in hl quick fix tests
To explicitly specify which test are failing
2021-04-01 18:24:17 +02:00
Ilya Kirillov 18ab9c7b25 Move HLApplicator from fir ide module to frontend-independent 2021-04-01 18:24:17 +02:00
Denis.Zharkov 5cbfb172a4 Ignore new FIR box test on android 2021-04-01 14:52:05 +03:00
sebastian.sellmair 3f3e51f36e CInteropCommonization: Filter out illegal dependencies
^KT-45832 Fixed
2021-04-01 10:30:23 +00:00
Ilya Kirillov c775508f64 FIR IDE: cache function symbols in FirIdeBuiltinSymbolProvider 2021-04-01 11:31:43 +02:00
Ilya Kirillov d5951bc97d FIR IDE: use EntityWasGarbageCollectedException instead of ISE in ReadOnlyWeakRef 2021-04-01 11:31:43 +02:00
Denis.Zharkov d685e2aac7 FIR2IR: Fix inheritance case from built-in interface with default methods 2021-04-01 12:11:37 +03:00
Alexander Shabalin e5ea7f5b4e Do not freeze enum in new MM 2021-04-01 08:41:08 +00:00
Ilmir Usmanov 786999bcfe Minor. Add regression tests
#KT-44143
2021-04-01 00:51:08 +03:00
Ilya Goncharov 03fed85447 [IR] Change copy method into shallowCopy in Native 2021-03-31 20:14:56 +03:00
Ilya Goncharov 368ac36204 [IR] Remove IrExpressionWithCopy and replace with shallowCopy method 2021-03-31 20:14:55 +03:00
Ilya Goncharov 084d824984 [IR] Use deepCopyWithSymbols in IrTypeOperatorCall 2021-03-31 20:14:54 +03:00
Ilya Goncharov 7046f9badd [IR] canHaveSideEffects more robust
By default copyable (IrExpressionWithCopy) declarations is considered as side-effects.

^KT-45655 fixed

[IR] isTrivial more robust

By default copyable (IrExpressionWithCopy) declarations is considered as trivials.

[IR] Use one source of truth for triviality of IrExpression
2021-03-31 20:14:53 +03:00
Ilya Goncharov 47f1a8a0bb [IR] Make IrTypeOperatorCall copyable
^KT-45655 fixed
2021-03-31 20:14:52 +03:00
Ivan Kylchik 2a5153f0fd Move visualizer black box tests generator to separate class 2021-03-31 19:46:23 +03:00
Ilya Gorbunov 94240f7b21 Stabilize unsigned types KT-45653
Deprecate specialized unsigned iterators for removal.

Fix compiler tests:
- drop unsignedLiteralsOn1_2 because apiVersion 1.2 is no longer supported
- drop experimental unsigned literals diagnostic test
2021-03-31 19:05:04 +03:00
Yahor Berdnikau 768c165a72 Fix Gradle 7 deprecation on adding associated compilation dependencies.
^KT-45787 Fixed
2021-03-31 18:23:53 +03:00
Nikolay Krasko 7f60cd81fe CodeConformanceTest for no Bintray except jcenter (KTI-528) 2021-03-31 17:38:59 +03:00
Nikolay Krasko b48ede4a62 Drop scripts for uploading to plugin repository (KTI-528) 2021-03-31 17:38:58 +03:00
Nikolay Krasko 35ad28c372 Bintray dukat -> Space kotlin/kotlin-dependencies (KTI-528) 2021-03-31 17:38:56 +03:00
Nikolay Krasko d10f4ad718 Drop Bintray from maven inspections tests (KTI-528) 2021-03-31 17:38:55 +03:00
Nikolay Krasko 03c0a81a33 Stop using Bintray in ignored test in MavenResolverTest (KTI-528) 2021-03-31 17:38:54 +03:00
Dmitry Petrov 9bf7f3af04 JVM_IR KT-45697 reference classes from sources before IR generation 2021-03-31 16:40:49 +03:00
Denis.Zharkov 7d211d0d9a Regenerate VisualizerBlackBoxTestGenerated 2021-03-31 15:57:03 +03:00
Denis.Zharkov fa65081878 Revert "FIR2IR: minimize scope processing in fake override generation"
This reverts commit 9934cfbb00.

See the tests added: Subclass may have private same-name method that
should not be a reason to avoid generating fake overrides
2021-03-31 15:57:03 +03:00
Denis.Zharkov 55e5af1111 FIR: Add workaround for flatMap issue 2021-03-31 15:57:03 +03:00
Denis.Zharkov 4d3825a824 FIR: Serialize members originated from delegation 2021-03-31 15:57:03 +03:00
Denis.Zharkov a130b110f1 FIR2IR: Fix incorrect conversion of adapted callable references with receiver 2021-03-31 15:57:02 +03:00
Denis.Zharkov 1f074326bf FIR: Fix Java scope in case of accessor with getter signature from supertype
^KT-45584 Fixed
2021-03-31 15:57:02 +03:00
Denis.Zharkov 24f35ef281 FIR: Minor. Extract FirDeclarationStatus.copy 2021-03-31 15:57:02 +03:00
Victor Petukhov f80b98cd0e Assert that the separation of two annotations on function type during rendering it, is any whitespace-like symbol, not only whitespace itself
E.g. in quick doc mode (HTML), it may be line break

^KT-38747 Fixed
2021-03-31 11:37:16 +03:00
Ilmir Usmanov cf73f182c7 Minor. Change warning message 2021-03-31 09:04:35 +03:00
Alexander Udalov 1f7cef6f13 Minor, add a bit more tests for KT-12063 2021-03-31 00:08:52 +02:00
pyos 66429cfb43 JVM_IR: do not inline @JvmStatic into their static proxies 2021-03-31 00:08:40 +02:00
pyos a518a9407d JVM_IR: remap calls to protected @JvmStatic in companions
Protected functions on unrelated classes cannot be called from outside
the current package, so in general, we can only call the static proxy,
not the original companion method.

This has an ABI compatibility implication in that removing `@JvmStatic`
from a protected companion method will require recompiling Kotlin use
sites (of course, this is already source- and binary-incompatible from
Java perspective).

 #KT-12063 Fixed
2021-03-31 00:08:40 +02:00
pyos 85aa6383ad JVM_IR: cast bound property receivers to original type
Because the receiver type is used for determining where to put
accessors, and the type of fake overrides' receivers is the same as for
the original declaration, casting to the type of the parameter leads to
assertion errors.

 #KT-44658 Fixed
2021-03-30 23:09:28 +02:00
Svyatoslav Scherbina 1d96f810da Native: fix target for ReturnsRetained and ConsumesReceiver annotations
These annotations can be used on Objective-C property accessors imported
to Kotlin.
Note: the annotations aren't used in source code, only generated
directly to metadata by cinterop. So this commit doesn't in fact fix
anything but rather makes the implementation less fragile.

See https://github.com/JetBrains/kotlin-native/issues/3336.
2021-03-30 20:23:59 +00:00
Svyatoslav Scherbina 107129679e Native: fix interop_objc_tests after recent frontend change
b60056f11e raises a warning to an error,
fixing this error here.
2021-03-30 15:32:46 +00:00
Mikhail Glukhikh bf2e83f64c Make same tests FIR_IDENTICAL 2021-03-30 18:06:06 +03:00
Shagen Ogandzhanian e0e2715864 [js] Fix constant folding for unsigned aithmetic in IR
this resolves KT-44138
2021-03-30 16:53:12 +02:00
Pavel Kirpichenkov 36bc71121a [IDE] Optimize stdlib cache for non-JVM modules
Consider only dependencies of JVM modules.
Cache found/missing stdlib dependencies for modules.

As of now, non-JVM platforms use default builtins in IDE.
For any non-JVM module indexed stdlib dependency is guaranteed
to be missing, searching for it is useless and costly.

^KTIJ-5666 Fixed
See also KT-44552
2021-03-30 17:28:08 +03:00