Commit Graph

87267 Commits

Author SHA1 Message Date
Mikhail Glukhikh f2c734fc02 FIR2IR: add another fallback for simple synthetic property 2021-11-09 21:04:39 +03:00
Mikhail Glukhikh b50350f6a5 FIR2IR: add fallback for a synthetic property override situation 2021-11-09 21:04:39 +03:00
Mikhail Glukhikh 67a05883d6 FIR2IR: create local classes on the fly properly 2021-11-09 21:04:38 +03:00
Mikhail Glukhikh a05244eca1 FIR: don't enhance synthetic property if not needed 2021-11-09 21:04:38 +03:00
Mikhail Glukhikh 6b1da9eb70 Rename: generateAccessorSymbol -> generateSyntheticPropertySymbol 2021-11-09 21:04:37 +03:00
Mikhail Glukhikh 5a44fda42c FIR2IR: bind fake override calls via symbol table 2021-11-09 21:04:37 +03:00
Mikhail Glukhikh d4cdf874be FIR2IR: add fake override generation for built-in classes 2021-11-09 21:04:36 +03:00
Mikhail Glukhikh 0622a47493 FIR2IR: implement early f/o overridden symbols binding #KT-42784 Fixed
Related to KT-49288
2021-11-09 21:04:36 +03:00
Mikhail Glukhikh 5b6e21690b FIR2IR: call fake overrides properly #KT-49288 Fixed 2021-11-09 21:04:35 +03:00
Dmitriy Novozhilov ec079a2663 [Build] Add runtime dependency on descriptors.runtime to tests for low level api
This is needed to keep ability to run those tests using JPS
2021-11-09 20:06:11 +03:00
Dmitriy Novozhilov 0a902c1bef [Build] Remove dist_root artifact from JPS project configuration
This artifact was used to build compiler artifact during each project
  build, which is not needed for running compiler tests. Removal of
  this artifact from build chain reduces time of build for ~3 seconds
  which is a lot for rebuilds after minor changes (which are usually
  take only few seconds)
2021-11-09 20:06:08 +03:00
sebastian.sellmair 1a0e2ad074 [Gradle][MPP] Composite metadata jar: Use "$sourceSetName-cinterop" directory for cinterops
This convention seems to be more robust against clashes against user
specified source set names. We could potentially foresee users to
use "cinterop" as source set name, but the pattern
 $sourceSetName-cinterop seems robust enough.

^KT-49596 Verification Pending
2021-11-09 16:34:33 +00:00
sebastian.sellmair ea669ce076 [Gradle][MPP] Assert sourceSetCInteropMetadataDirectory on deserialized older metadata files
^KT-49596 Verification Pending
2021-11-09 16:34:33 +00:00
sebastian.sellmair bd8aa8ae3d [Gradle][MPP] Include cinterop metadata directory in kotlin-project-structure-metadata.json
- Also increase the KotlinProjectStructureMetadata's format
version to 0.3.2

- Move new default location into /cinterop/{sourceSetName}

^KT-49596 Verification Pending
2021-11-09 16:34:32 +00:00
Sergej Jaskiewicz 7b017fad90 [JS IR] Add tests for KT-41964 and KT-44981 2021-11-09 14:34:13 +00:00
Alexander Udalov f5dd0abb76 Render JVM default flags in kotlinp 2021-11-09 15:09:29 +01:00
Steven Schäfer c552b5f820 kotlinx-metadata-jvm: Handle the jvmClassFlags extension 2021-11-09 15:09:20 +01:00
Alexander Udalov 9bc87b17bd Build: suppress wasm stability warning
To prevent it from being displayed when configuring
`:kotlin-stdlib-wasm` and ':kotlin-test:kotlin-test-wasm' on each build.
2021-11-09 14:56:24 +01:00
Alexander Udalov 73f0540d5b Remove runtime jar files version checker
... and the compiler argument -Xskip-runtime-version-check.

The vast majority of warnings reported by this checker in practice has
proven to be false positives. In addition to that, it was needlessly
verbose, and also completely untested.

If we decide to reintroduce some of these checks, it's probably a better
idea to perform them in tools, such as Kotlin Gradle plugin, which
usually have slightly more information about the way the project is
built and can suggest some meaningful solutions (as opposed to "remove
this jar $HOME/.gradle/... from the classpath" which was the best
JvmRuntimeVersionsConsistencyChecker could do.)

 #KT-27256 Obsolete
 #KT-41664 Fixed
2021-11-09 14:56:10 +01:00
Svyatoslav Scherbina c929404fa4 Native: don't treat any compiler test task as up-to-date
There are number of problems with up-to-date checks in tests, leading to
a test binary not being rebuilt or rerun when a developer expects it to.

Things became worse after updating to Gradle 7+:
test binary run tasks are considered up-to-date if the test data
has been changed, even after clean.

Even before Gradle 7+, we've observed other similar undesirable effects:
for example, if the compiler has been changed, tasks building
test binaries are still up-to-date.

There are quite a lot of different tasks related to running the tests
for Native, many of them are misused and thus don't do what we expect.
Carefully fixing each particular kind seems counterproductive and
unreliable.

So instead workaround all possible similar problems by forcing all tasks
in the :kotlin-native:backend.native:tests project to be not up-to-date.

This project should contain only test tasks, so this workaround
seems pretty natural -- it is just "tests aren't up-to-date".
2021-11-09 11:18:08 +00:00
Svyatoslav Scherbina d5bf99f80c Native: make FrameworkTest implement Serializable
Gradle requires this when using it as task input.
2021-11-09 11:18:08 +00:00
Hung Nguyen bd7c2ae6d7 KT-45777: Snapshot Java classes using ASM analysis directly
This is faster than the current approach which creates
`JavaClassDescriptor`s, converts them to protos, and then snapshots
these protos.

- Refactor unit tests to faciliate further changes
- moves test data to a directory that matches the tests' package name
- moves expected snapshots to a separate directory
- adds public and private fields/properties to sample class
- Compute changes between ASM-based Java class snapshots
- Don't collect members of an added Java class as changes
as it's enough to report the name of the added Java class as changed (we
also do that for added Kotlin classes and Kotlin/Java removed classes).
- Add unit tests for impact analysis in advance
- Compute impacted symbols of changed symbols
Also do not collect added classes/class members as they don't impact
recompilation.
-Use ClassId when computing Java class changes
It is more precise than JvmClassName, which can be ambiguous around the
`$` character (e.g., ClassId "com/example/A$B.C" and "com/example/A.B$C"
both have the same JvmClassName "com/example/A$B$C").
- Compute impacted set of changed symbols across Kotlin and Java
- Add unit tests for impact analysis across Kotlin and Java
- Compute supertypes of Kotlin classes during snapshotting
- Handle inner classes when computing list of changed symbols.
For the reported symbols, always check all options:
class member, inner class, top level class, top level member.

Test: IncrementalJavaChangeClasspathSnapshotIT.testAddingInnerClass
2021-11-09 13:57:56 +03:00
Dmitry Petrov 271368ac53 JVM_IR prefer loop with inclusive bound for unsigned integer ranges
In general, we would rather prefer a range-based for loop to look like
a counter loop in Java ('for (i = start; i < end; ++i) { <BODY> }').
This corresponds to

    i = start;
    do {
        if (i >= end) break;
        <BODY>
    } while ( { ++i; true } )

However, HotSpot doesn't recognize Kotlin unsigned integer comparison
in 'if (i >= end) break;' as a counter loop condition. Thus, the loop
doesn't get optimized as a counter loop, resulting in a performance
regression.
If we use exclusive range-based for loop instead, then we actually use
unsigned integer equality instead of unsigned integer comparison, which
is Ok for HotSpot.

KT-49444
2021-11-09 13:25:06 +03:00
Pavel Punegov a207a3e8fa [K/N][test] Don't use assertFailsWith on wasm32 in the test 2021-11-09 09:55:13 +00:00
Martin Petrov 416d12bce8 [Native] Lazily create dependency & cache directories. (#4627)
Previously initializing the DependencyProcessor will result in file IO.

In a fully-hermetic environment where all dependencies are local, this IO is redundant and may require the build system (e.g. Bazel) to do extra setup to ensure there is a local writable directory specified for these directories. This change will instead cause the dependency processor to bail early and skip downloading dependencies if all are local anyway.

Prior to this change kicking off a clean build with local dependencies would result in:

```
rm -rf ~/.konan/cache; fswatch -ax ~/.konan
~/.konan/cache Created IsDir
~/.konan/cache/.lock Created IsFile
```

After the change no FS operations are performed.
2021-11-09 11:30:30 +03:00
Sergey Bogolepov f43b5d32f9 Add tests for Char.isHighSurrogate() and Char.isLowSurrogate() 2021-11-09 08:27:59 +00:00
Sergey Bogolepov bc144887ea [K/N] Add native test for KT-48591
We can't rely on stdlib tests now, because they are not
executed with compiler caches.
2021-11-09 08:27:58 +00:00
Jinseong Jeon 08e181a543 FIR IDE: add tests about types of array/list and their element 2021-11-09 09:25:45 +01:00
Mads Ager e1f6c19c83 [FIR] Fix local variable tests.
- Mangle names for extension receivers in lambdas
 - Correctly mark anonymous variables and variables for arguments
   for destructuring declaration.

There is one failure remaining which is cause by lambda
type inference differences that leads to FIR having an explicit
return from the lambda whereas old frontend leads to an implicit
return. This difference is visible in debug stepping that the
local variables tests do because the implicit return has the line
number of the closing brace of the lambda. This change adds an
IrText test to make the difference clear.
2021-11-09 11:09:11 +03:00
Mads Ager 99293de6e9 [FIR] Enable local variable tests. 2021-11-09 11:09:00 +03:00
Ivan Kylchik 3adf80ed37 [TESTS] Replace IrBackendInput if check with require 2021-11-08 23:50:36 +03:00
Ivan Kylchik ef8199718e [JS TESTS] Move externals.js into main module in functionTypes.kt 2021-11-08 23:50:35 +03:00
Ivan Kylchik 81211acbc0 [JS TESTS] Extract common code responsible for getting dependencies 2021-11-08 23:50:35 +03:00
Ivan Kylchik fdf3288e3d [JS TESTS] Move dump of artifacts into js ir backend facade 2021-11-08 23:50:35 +03:00
Ivan Kylchik 7d00dd98d5 [JS TESTS] Suppress unused parameter in incremental handler 2021-11-08 23:50:35 +03:00
Ivan Kylchik db6c357e8e [JS TESTS] Enable diagnostic report for tailRecursion 2021-11-08 23:50:35 +03:00
Ivan Kylchik 54804417dd [JS TESTS] Rewrite js ir ic tests using new test infrastructure 2021-11-08 23:50:35 +03:00
Ivan Kylchik 982d10d127 [TESTS] Add IGNORE_ERROR directive to boxError tests
This is needed because now these tests use new test infrastructure
and here, after frontend facade, there is error check. We need to
disable such check in these tests.
2021-11-08 23:50:34 +03:00
Ivan Kylchik 9628412ff4 [TESTS] Remove ignore directive from some of tailrec tests for JS IR 2021-11-08 23:50:34 +03:00
Ivan Kylchik c59098df2f [JS TESTS] Rewrite js ir tests using new test infrastructure 2021-11-08 23:50:34 +03:00
Ivan Kylchik 0e4cf05d3e [JS TESTS] Fix es module test files for new test infrastructure 2021-11-08 23:50:34 +03:00
Ivan Kylchik 68c9156053 Add possibility to get line offsets from PsiIrFileEntry
This is needed for tests to be able to get offsets without explicit
file on disk.
2021-11-08 23:50:34 +03:00
Ivan Kylchik edd608446e [TESTS] Move WITH_RUNTIME directive to file level 2021-11-08 23:50:34 +03:00
Ivan Kylchik 37f02390ec [TESTS] Extract common backend directives into ConfigurationDirectives 2021-11-08 23:50:33 +03:00
Ivan Kylchik 108d6b63dd [TESTS] Add abstraction at IrBackendInput to work with several backends 2021-11-08 23:50:33 +03:00
Ivan Kylchik 701a10d643 Split some functions of js compiler to be able to use them in tests 2021-11-08 23:50:33 +03:00
Jinseong Jeon 4eec381d1b FIR IDE/LC: introduce/use KtTypeMappingMode 2021-11-08 20:12:17 +01:00
Jinseong Jeon 0da9ef873a FIR LC: use optimal type mapping mode for return type 2021-11-08 20:12:17 +01:00
Jinseong Jeon d3c34fa200 FIR LC: use optimal type mapping mode for value parameter 2021-11-08 20:12:17 +01:00
Jinseong Jeon 6d150fb7a5 FIR IDE: add APIs about FunctionClassKind 2021-11-08 20:12:17 +01:00