Commit Graph

42443 Commits

Author SHA1 Message Date
Alexander Udalov 3ead2e9cd4 Use KotlinCoreEnvironment.createForTests in test code
createForProduction creates and caches JavaCoreApplicationEnvironment
instance, which can alter behavior of subsequent tests
2017-11-03 14:03:02 +01:00
Alexander Udalov dddd1cdba5 Use JUnit 3 + KtUsefulTestCase instead of JUnit 4 in compiler tests
This is needed because KtUsefulTestCase performs useful cleanup at the
end of the test (namely, resets ApplicationManager#ourApplication to
null)
2017-11-03 14:03:02 +01:00
Alexander Udalov 3049b5d92f Remove logging in KotlinSuppressCache.isSuppressedByAnnotated
It produces lots of useless output in stderr when tests are run with
Gradle in the terminal
2017-11-02 17:15:59 +01:00
Alexander Udalov b43b470b8f Move Java 8 tests generator to tests-java8, run it in "Generate Compiler Tests" 2017-11-02 17:13:05 +01:00
Alexander Udalov f52ba44e90 Move JS tests generator to :js:js.tests, run it in "Generate Compiler Tests"
Also cleanup generateTestDataForReservedWords and make everything there
private
2017-11-02 17:12:46 +01:00
Alexander Udalov 8c6ed3e872 Generate IR tests in GenerateCompilerTests.kt 2017-11-02 17:12:46 +01:00
Ilya Gorbunov 61b78d7eda Make projectTests type of dependency transitive on testRuntime dependencies
`tests-jar` configuration now extends testRuntime instead of testCompile
(note that testRuntime extends testCompile),
and projectTests() dependency shortcut makes it transitive.

This is required to depend on test utility modules producing `-tests` jar instead of default one
without listing all their transitive dependencies.
2017-11-02 18:19:52 +03:00
Ilya Gorbunov 3cfb1fd6a7 Simplify dependency setup for jvm6 codegen test server 2017-11-02 18:18:58 +03:00
Simon Ogorodnik 339d06d040 Improve diagnosticMissingPackageFragment reporting
Single execution path to report missing package fragment problems

Split failures on PluginDeclarationProviderFactory site by
known reasons to improve exception analysis
2017-11-02 16:31:43 +03:00
Alexander Udalov 56a51c1d22 Do not treat annotation classes as interfaces in bridges codegen
From Kotlin's point of view, everything in annotation classes is
non-abstract. A class inheriting from an annotation has a non-abstract
fake override for each property of the annotation class constructor. But
because members of annotation classes themselves were considered as
abstract in the bridge-generating code (see
DescriptorBasedFunctionHandle.isAbstract), there was a situation where a
concrete fake override has only one declaration among overridden
descriptors and it was abstract. This situation is invalid (a concrete
fake override must have exactly one concrete super-declaration),
therefore an exception was thrown.

The fix is to avoid considering annotation class members abstract for
the purposes of bridge generation. It's reasonably safe because no
bridges should be ever generated for annotation subclasses anyway,
because annotations can only have members with simple return types
(final and non-generic).

Note that in KT-19928, the problem is reproducible because of an
incorrect "inexact analysis" in light classes where "Target" is resolved
to an annotation class kotlin.annotation.Target. This behavior of the
analysis in light classes seems to do no harm otherwise, so it's not a
goal of this commit to change anything in that regard

 #KT-19928 Fixed
2017-11-02 14:02:09 +01:00
Mikhail Glukhikh 8f98f00030 Explicit / implicit this: analyzeFully --> analyze 2017-11-02 14:07:57 +03:00
Mikhail Glukhikh 6a7cdc01a6 Fix 'this' case in implicit this inspection 2017-11-02 14:07:55 +03:00
Mikhail Glukhikh 64a51fe0d1 Implicit this inspection: minor cleanup 2017-11-02 14:07:46 +03:00
Kirill 89c4196c06 Add inspections for implicit and explicit 'this' #KT-4580 Fixed 2017-11-02 14:07:45 +03:00
Ilmir Usmanov 817f79520a Implement coroutineContext intrinsic
This intrinsic allows coroutine to access its context without suspention
and, furthermore, disabling tail-call optimization.
KT-17609: Fixed
2017-11-02 12:45:24 +03:00
Toshiaki Kameyama 0fffb9fb17 Introduce inspection for callables with implicit 'Nothing?' type
Inspection is reported only for vars and open callables
So #KT-21023 Fixed
2017-11-02 12:21:14 +03:00
Mikhail Glukhikh bcbeab00d5 Slightly change IntentionBasedInspection status
Only constructor and not the whole class is now deprecated
2017-11-02 12:21:13 +03:00
Toshiaki Kameyama 9ea9ea1008 Add quick fix to add required target to annotation #KT-20484 Fixed 2017-11-02 11:07:53 +03:00
Toshiaki Kameyama 204d9e3423 Introduce inspection detecting self-assignment of properties
So #KT-20714 Fixed
2017-11-02 11:07:52 +03:00
Vyacheslav Gerasimov ffa9478d0c Configure Kotlin: add mavenCentral() to repositories
Since kotlin stdlib depends on artifacts from mavenCentral() we should add it
 #KT-18719 Fixed
2017-11-01 23:57:20 +03:00
Ilya Gorbunov 093f796fc7 Write compiler and stdlib versions from gradle build 2017-11-01 17:26:18 +03:00
Ilya Gorbunov 6fe299cd5b Fix core:builtins:serialize task outputs 2017-11-01 17:09:10 +03:00
Ilya Gorbunov be63f09f8f Remove some workarounds for extra properties and signing,
use new syntax for maven repo definition.
2017-11-01 17:09:10 +03:00
Ilya Gorbunov 4d4285824b Use Gradle 4.3 2017-11-01 17:09:10 +03:00
Dmitry Savvinov e17610f378 Don't throw on recursion when computing member scope
When recursion is detected while computing
`ClassResolutionScopesSupport.scopeForMemberDeclarationResolution`,
create 'ThrowingLexicalScope' (as with other scopes), instead of
throwing ISE immediately. That allows to report error properly in cases
like in KT-18514

#KT-18514 Fixed
2017-11-01 15:57:56 +03:00
Simon Ogorodnik d6143e2af6 Fix testData broken after KT-12797 2017-10-31 21:11:19 +03:00
Simon Ogorodnik 0a4860b4d7 Add instrumentation to locate not cleared MockApplication 2017-10-31 20:25:00 +03:00
Mikhail Glukhikh f6a7327758 Remove ultimate tests from "Generate All Tests" configuration 2017-10-31 18:21:53 +03:00
Mikhail Glukhikh 50ebcfe09e Test generator: return back forgotten convert line separators 2017-10-31 18:05:20 +03:00
Dmitry Petrov c2b9803933 Generate source information for synthesized data class members
For now, bind such elements to data class declaration.

 #KT-20443 Fixed
2017-10-31 17:34:32 +03:00
Dmitry Jemerov 44260cdc7c Working recognition of JUnit annotation in MP tests
(cherry picked from commit 3a21781)
2017-10-31 14:45:09 +01:00
Alexander Udalov 2ed3e88561 Create descriptors with Kotlin package name in decompiler/cls stub builder
(cherry picked from commit b2620d1)
2017-10-31 14:44:52 +01:00
Dmitry Jemerov f93f502ebe Read package name in KotlinClassHeader and use it in decompiler
(cherry picked from commit 119d5ab)
2017-10-31 14:44:39 +01:00
Mikhail Glukhikh d59276671f Related to KT-20631: don't report redundant blank Unit in lambda 2017-10-31 16:38:55 +03:00
Toshiaki Kameyama 0fd4cdb086 Fix false positive for "redundant super" in data class #KT-20981 Fixed 2017-10-31 15:15:19 +03:00
Mikhail Glukhikh 63ad89eeb0 Minor cleanup 2017-10-31 15:03:55 +03:00
Toshiaki Kameyama ef71f7707d Introduce inspection to detect use of Unit as a standalone expression
So #KT-20631 Fixed
2017-10-31 14:51:06 +03:00
Toshiaki Kameyama 5f4233e4bf Don't suggest "Remove explicit type specification" for an annotated type
So #KT-20622 Fixed
2017-10-31 14:37:36 +03:00
Alexander Udalov fbda2a4343 Do not use MockLibraryUtil in AbstractTopLevelMembersInvocationTest
MockLibraryUtil runs the compiler in the new class loader, which is
useful for IDE tests to avoid loading KotlinCoreEnvironment, but is not
needed and is suboptimal for compiler tests.

Also use another method in AbstractForeignAnnotationsTest to assert that
there are no files in the compiled libraries
2017-10-31 07:36:46 +01:00
Alexander Udalov a64fc10e94 Extract compiler-executing code in AbstractCliTest to CompilerTestUtil 2017-10-31 07:36:46 +01:00
Alexander Udalov 8695c6a1e4 Extract GenerateCompilerTests out of GenerateTests
Rename the run configuration "Generate Tests" -> "Generate All Tests"
2017-10-31 07:36:46 +01:00
Alexander Udalov d0274c3c53 Extract 'test-generator' module out of 'generators'
Also avoid using intellij API where kotlin-stdlib can be used instead
2017-10-31 07:36:45 +01:00
Alexander Udalov d79b571781 Rename ultimate's GenerateTests -> GenerateUltimateTests, regenerate 2017-10-31 07:36:45 +01:00
Alexander Udalov 8786c951a6 Move compiler/tests-common-jvm6/{src -> tests}, adjust dependencies 2017-10-31 07:36:45 +01:00
Alexander Udalov 33549362cb Move compiler/tests-common/{src -> tests}, adjust dependencies 2017-10-31 07:36:45 +01:00
Alexander Udalov c2276e2ccb Rename module ':compiler.tests-common' -> ':compiler:tests-common' 2017-10-31 07:36:45 +01:00
Alexander Udalov ef00807a18 Refactor test class name computation in GenerateTests
Allow to pass the FQ name of the base test class, instead of the Class
object (to avoid dependencies on other modules)
2017-10-31 07:36:45 +01:00
Dmitry Jemerov c009f94eea Restore task dependency which is needed to run the plugin correctly 2017-10-31 02:48:18 +01:00
Alexander Udalov 959299eeab Use project.findProperty instead of project.property where nullable is fine
findProperty throws MissingPropertyException if there's no such property
2017-10-30 15:53:06 +01:00
Alexander Udalov ccd7bfa337 Add project property to change port for codegen tests on different JDKs 2017-10-30 15:40:17 +01:00