Commit Graph

63237 Commits

Author SHA1 Message Date
Mikhail Bogdanov 64a4d09bb3 Add basic synchronization workaround for scratch 2020-03-24 10:58:58 +01:00
Pavel Kirpichenkov dc18c62dbc [NI] Filter out type variable from its dependencies
Don't take into account complex variable dependency on itself when determining fixation status.
^KT-37621 Fixed
2020-03-24 12:49:18 +03:00
Dmitry Gridin 7f6124254f Remove redundant plugin-common.xml.191 2020-03-24 09:35:12 +00:00
Dmitry Gridin 32dba0afa2 Move implementation of runForWholeFile field to xml 2020-03-24 09:35:11 +00:00
Dmitry Gridin f92936ae12 AbstractKotlinInspection: fix suppressor
#KT-37576 Fixed
2020-03-24 09:35:10 +00:00
Dmitry Gridin eaa21f86c4 QuickFixTest: all inspections should be initialized from EP 2020-03-24 09:35:10 +00:00
Dmitry Gridin 84c9929935 i18n: NativeDefinitions: remove redundant bundle
#KT-37483
2020-03-24 16:18:05 +07:00
Mikhail Glukhikh 03143bc788 [FIR2IR] Implement mapping of FIR & IR built-in class members 2020-03-24 12:15:18 +03:00
Dmitry Petrov afacb4b4b2 KT-37604 Use proper type when generating constructor call 2020-03-24 11:31:47 +03:00
Victor Turansky 95857c5af4 KT-34468 Yarn. Add entry registry 2020-03-24 11:28:02 +03:00
Victor Turansky 35e3691d6c KT-34468 Yarn. Lock file check at the beginning 2020-03-24 11:28:02 +03:00
Victor Turansky 8cd23dfc9a KT-34468 Yarn. Remove redundant collection creation 2020-03-24 11:28:02 +03:00
Victor Turansky 21cd5086ed KT-34468 Yarn. Named parameters for NpmDependency 2020-03-24 11:28:02 +03:00
Victor Turansky 6931b37a79 KT-34468 Yarn. Dependency search key calculated once 2020-03-24 11:28:02 +03:00
Victor Turansky 0d1bf66c2a KT-34468 Yarn. Star version support fix 2020-03-24 11:28:02 +03:00
Victor Turansky d494881cb9 KT-34468 Yarn. Dependency check at the beginning 2020-03-24 11:28:02 +03:00
Victor Turansky c2b3dd8b33 KT-34468 Yarn. Support dependency GitHub version 2020-03-24 11:28:02 +03:00
Dmitry Gridin afb8ff1dd5 i18n: NativeDefinitions: add getter to property
#KT-37483
2020-03-24 15:25:53 +07:00
Mikhail Zarechenskiy ec4d9d2f1f [NI] Prefer between two complex variables one with proper lower bounds
This reverts commit d4d35bb766.
2020-03-24 11:13:55 +03:00
Mikhail Glukhikh a4c7619c89 [FIR2IR] Introduce & use FirBuiltInsPackageFragment
Without this commit, JVM name mapping logic in BE does not work for FIR,
because FIR cannot use old BuiltInsPackageFragmentImpl descriptor.
In this commit we add our own implementation thus fixing
a pack of FIR black box tests.
2020-03-24 10:37:53 +03:00
Dmitriy Dolovov 01558f48ae KLIB: Clean-up AbstractKlibLibraryInfo API 2020-03-24 13:37:51 +07:00
Dmitriy Dolovov c9245ef497 IDE: Port JS to use the same KLIB utilities as Native & Common 2020-03-24 13:37:38 +07:00
Dmitriy Dolovov e81479e30b KLIB: Avoid check for KLIBs w/o components for other platforms than Native 2020-03-24 13:37:26 +07:00
Sergey Igushkin ad1a1ac49a Fix failures when a common source set compiled to nothing (KT-36674)
This could happen:
* when a common source set had no sources
* when the compile task of a common source set was disabled

In those cases, there were two subsequent failures:
* the metadata JAR could not interpret the missing klib file as ZIP
* the consumer could not read the empty klib in its dependencies

Issue #KT-36674 Fixed
2020-03-24 01:48:34 +03:00
Sergey Igushkin 066d413fb8 Add a test for host-specific metadata publishing and consumption 2020-03-24 01:48:34 +03:00
Sergey Igushkin 2478a57646 Rework source sets metadata consumption
* Add `ResolvedMppVariantsProvider` that provides variant names,
  platform artifacts, and metadata artifacts for MPP dependencies

* Rework SourceSetVisibilityProvider.kt so that it uses the
  `ResolvedMppVariantsProvider` to determine which source sets should be
  read from which metadata artifacts

* Rework `GranularMetadataTransformation` and its consumers so that:

  * it uses the
    visibility result and extracts the source set metadata from the
    host-specific artifacts whenever `SourceSetsVisibilityProvider`
    yields host-specific artifacts in the visibility results

  * it uses the new Gradle API for resolutionResults / artifactView

* Rework module IDs in the code base, unify the logic of their
  construction, also fix possible false-positive visibility in
  `applyToConfiguration` that used a module ID that mismatched the
  published module ID.
2020-03-24 01:48:33 +03:00
Sergey Igushkin 33ef4452b7 Always create shared-Native metadata compilations
Create the compilations even when all of the targets that the
shared-Native source set is compiled for are disabled on the current
host. In that case, disable the compilation task

Also clear the inputs of the disabled tasks so that when Gradle builds
the task graph it doesn't resolve the dependencies.

Otherwise, a Gradle build that includes the compile tasks of the
disabled targets in the task graph would fail as follows, e.g. on a
macOS host with a project containing a mingw target):

```
Could not determine the dependencies of task ':compileKotlinMingwX86'
...
Could not resolve all task dependencies for configuration
':mingwX86CompileKlibraries'
...
Could not find com.example:my-dependency-mingwx86:1.0
...
2020-03-24 01:48:33 +03:00
Sergey Igushkin 593869aa37 Fix incorrect unchecked cast in kotlin.metadata()
It was broken once the metadata target got K/N compilations along with
K2Metadata compilations.
2020-03-24 01:48:33 +03:00
Sergey Igushkin 94e3fa2132 (minor) Extract constants for XML nodes in project structure metadata 2020-03-24 01:48:33 +03:00
Sergey Igushkin f30aada84a If a source set is host-specific, publish it within the Native modules
Consider host-specific all source sets that participate in a compilation
of a target that cannot be built on some of the hosts.

Exclude those source sets from the `-metadata` artifact since the
`metadata` target must publish in the same way from any host.

Instead, add a metadata variant to those targets which use such a source
set and pack the source set's klib into a similar metadata JAR as the
artifact of those metadata variants.
2020-03-24 01:48:32 +03:00
Ilya Gorbunov d7007044c2 Add a note about the Random(...) generators being not thread-safe 2020-03-24 01:37:03 +03:00
Ilya Chernikov 44ffed9590 Approximate only types substituted with captured types
properly fixes #KT-37389
#KT-37389 fixed
#KT-37644 fixed
2020-03-23 22:58:45 +01:00
Martynas Sateika 49ae3c3db0 Supply missing 'project' argument to ReplaceWith replacement 2020-03-23 21:46:50 +03:00
Vladimir Dolzhenko a832c12550 Fetch analysis results if it is available
Relates to #KT-37467 and #KT-37515
2020-03-23 14:49:47 +00:00
Vladimir Dolzhenko 0073d260f8 Fix incremental analysis for whitespaces
incremental analysis could ignore whitespace iff old item was whitespace

#KT-37629 Fixed
2020-03-23 14:46:55 +00:00
Vladimir Dolzhenko 8935c600c1 Add checkCanceled on find usages execution path
#KT-36138 Fixed
2020-03-23 14:46:13 +00:00
Mads Ager baf1f56859 [JVM_IR] Rebase test of string concatenation codegen.
The JVM IR backend code seems saner to me. The string concatenation
lowering for JVM IR calls the stringPlus intrinsic if there are
only two arguments. That leads to a lot less code:

```
load string
load argument
box argument
call Intrinsics.stringPlus
```

instead of

```
allocate StringBuilder
call StringBuilder.<init>
load string
call StringBuilder.append
load argument
call StringBuilder.append
call StringBuilder.toString
```

This will lead to more boxing, but a lot smaller code. We still
use StringBuilders in JVM IR if there are more than two strings
being concatenated.
2020-03-23 16:42:53 +03:00
Mikhail Zarechenskiy 1cf970b110 Revert "Minor. Specify type arguments explicitly"
This reverts commit 2e9075115b.
2020-03-23 16:39:22 +03:00
Mikhail Zarechenskiy 191fb02bf6 [NI] Consider intersection type with number type as Nothing
Currently, only for "in": In<in Int & A> == In<in Nothing> == In<*>

 #KT-37302 Fixed
2020-03-23 16:39:21 +03:00
Mikhail Zarechenskiy b23aff4d0d [NI] Type-check lambda arguments against approximated type
It's required as we analyze lambda with the approximated type too
2020-03-23 16:39:20 +03:00
Mikhail Zarechenskiy 72ce4eb5ee Minor, replace fields with getters to avoid leaking "this" inspection 2020-03-23 16:39:19 +03:00
Ilya Goncharov e6d39ce785 [Gradle, JS] True on check exit code in mocha
#KT-37668 fixed
2020-03-23 15:36:52 +03:00
Nick abcd6bd528 [FIR] Support diagnostic SUPER_IS_NOT_AN_EXPRESSION 2020-03-23 15:14:06 +03:00
Mikhail Glukhikh ca22e05acd [FIR2IR] Support safe calls 2020-03-23 15:13:50 +03:00
Mikhail Glukhikh 2e8b22e4be [FIR2IR] Use wrapped property accessor descriptors for accessors 2020-03-23 15:13:33 +03:00
Mikhail Glukhikh 92ac1d3f3d FIR: use FirDefaultPropertyAccessor if no body also in lightTree builder 2020-03-23 15:13:17 +03:00
Jinseong Jeon e46a4246d2 FIR: regard property accessor without body as FirDefaultPropertyAccessor 2020-03-23 15:12:54 +03:00
Roman Elizarov e26a3ad033 Speed up stdlib readLine function (#3185)
There are several performance optimizations:

* ByteBuffer/CharBuffer/StringBuilder objects pre-allocated and are
  reused on each call to readLine.
* The state for readLine is lazily allocated via JVM classloading
  (using a singleton object).
* There is an auto-detection heuristic for "directEOL" encodings which
  represent LF ('\n') directly as the corresponding byte
  (UTF-8 and many single-byte encodings are like that).
  When "directEOL" encoding is used, then bytes are batched into
  ByteBuffer for a single call to CharsetDecoder.decode which
  results in higher throughput. Otherwise (UTF-16, etc), slower
  byte-by-byte approach is used.
* Bytes and chars are directly moved in/out of byte/char arrays and
  ByteBuffer/CharBuffer wrappers are used only to interface with
  JVM CharsetDecoder class (which is the slowest piece).
* StringBuilder is not used at all for short lines (<=32 chars).

There are also some function improvements to readLine functionality:

* Restriction on "max chars per byte" is lifted, so readLine works with
  all encodings that JVM supports.
* It support on-the-fly changes to system default charset, because
  it rechecks current charset on each call and updates it decoder
  when needed.

All the other features of readLine function are retained:

* It does not read more bytes from System.in than needed, so it
  is compatible with other ways to read System.in. On-the-fly
  changes to System.in are supported.
* It is thread-safe. Its internal mutable state is protected by
  synchronization.
* There is an internal method for tests that supports explicit
  charset specification, but the name of this method has changed.

There are additional tests:

* Check all supported encodings on JVM to make sure that readLine
  works correctly with them all.
* Check unicode code points of different bits length with all standard
  unicode encodings (UTF-8, UTF-16, and UTF-32 in LE/HE byte orders).

Benchmarks that compare different implementations of readLine,
including this one (readLine6NoLV in the set) can be found here:
https://github.com/elizarov/ReadLineBenchmark

Taking BufferedReader as 100% baseline we see that:

* Current readLine is 7.5 times slower than BufferedReader baseline.
* New implementation in this commit is 2.5 timer slower than baseline.
  It is ~3 times faster than existing implementation of readLine.

Altogether these optimizations are enough to enable reading of
~500K lines in sports programming setting under 2s time-limit with
plenty of headroom in time. Example that is using this version of
readLine can be found here:
https://codeforces.com/contest/1322/submission/73005366

#KT-37416 Fixed
2020-03-23 14:36:55 +03:00
Mikhail Bogdanov aae6319c39 Minor. Specify test runner to support parallel test execution 2020-03-23 12:27:52 +01:00
Vladimir Ilmov cd12226f20 (CoroutineDebugger) Alternative CoroutineInfoProvider added
Added way to retrieve coroutine information without an agent
in target JVM. 'kotlin.debugger.coroutines.switch' provides
two possibilities to test coroutines.
Agent way gets activated once kotlinx.coroutines.debug.DebugProbes
started with javaagent.
Library-less ways use DispatchedContinuation or ChildContinuationImpl
classes to retrieve coroutine information and stack traces.
2020-03-23 12:27:07 +01:00