Commit Graph

56350 Commits

Author SHA1 Message Date
Ilya Chernikov 5ed6573a60 Fix testLazyScriptDefinitionProvider:
The KtUsefulTestCase functionality is not used here but seems causes
the side effects resulting in failing test, probably exactly because
the infrastructure loaded by the KtUsefulTestCase is never called
2019-07-19 16:37:50 +02:00
Ilya Chernikov 853f2a9c3f Fix flaky failures in main-kts IT 2019-07-19 16:37:50 +02:00
Ilya Chernikov c0804000eb Shorten temp paths used in tests
#KT-32490 fixed
2019-07-19 16:37:50 +02:00
Ilya Chernikov ee0f55d8e1 Fix gradle IT with scripting discovery
The test is not designed to fail if the definitions are not discovered -
the script files have completely custom extensions and therefore ignored.
So checking for the warning in the build log is enough.
#KT-32697 fixed
2019-07-19 16:37:50 +02:00
Ilya Chernikov 747c488a78 Fix entries closing on saving compiled script to jar:
also adding a short sleep in tests, otherwise in some cases the
classloader was not able to find class in the jar.
Fixes script to jar saving tests on windows
2019-07-19 16:37:49 +02:00
Ilya Chernikov 5b3164ee87 Ignoring resolver tests that failing on TC:
should be rewritten to the new scripting API
Some additional diagnostics improvements are remained for possible
future usage.
2019-07-19 16:37:49 +02:00
Ilya Chernikov 823cb70ba0 Fix script definition matching for REPL console
fixes IdeReplCompletionTestGenerated tests
in addition, fix default ScriptDefinition generation
2019-07-19 16:37:49 +02:00
Ilya Chernikov 425deb42ec Convert paths to unix format before matching with filePathPattern
should also fix testPathPattern5_kts test
2019-07-19 16:37:49 +02:00
Natalia Selezneva 7d6bb023a8 Invalid script dependencies should be removed from fileAttributes to avoid 'all red file highlighting'
^KT-32061 Fixed
2019-07-19 12:45:56 +03:00
Natalia Selezneva dd437b585b Scratch tests: check output after repl stop because error output is printed only after repl process termination
This should fix flacky tests
2019-07-19 12:45:03 +03:00
Natalia Selezneva b9968ee1af Do not call onFinish for executor that wasn't started 2019-07-19 12:45:03 +03:00
Natalia Selezneva 2fa7ef2482 Tests, refactoring: replace invokeLater with TransactionGuard to avoid situations that project isDisposed during inlays printing 2019-07-19 12:45:03 +03:00
Natalia Selezneva ec1bef639f Tests, refactoring: do not search for psi file twice 2019-07-19 12:45:02 +03:00
Natalia Selezneva fe662fcb2e Provide a mesaage for NPE in scratch tests 2019-07-19 12:45:02 +03:00
Roman Golyshev a32b1970e6 KT-31295: Disable module selection toolbar for .ws.kts files
^KT-31295 Fixed
2019-07-19 12:45:02 +03:00
Roman Golyshev e54b43bab1 KT-31295: Enable support for .ws.kts files as for scratch files 2019-07-19 12:45:02 +03:00
Roman Golyshev 232c7fdd0e KT-31295: Add New Kotlin Worksheet action
- creates new kotlin file with `.ws.kts` extension
2019-07-19 12:45:01 +03:00
Natalia Selezneva f6b03dc02f Add Show Kotlin Gradle DSL Logs Action (KT-31440)
Provide a label for this action in some script diagnostics from gradle dsl resolver
^KT-31440 Fixed
2019-07-19 12:06:09 +03:00
Dmitry Petrov dd3f8ecaac IR BE Common: Provisional IrFunctionExpression lowering
Transforms IrFunctionExpression elements to local function references,
as it was done before IrFunctionExpression introduction.
2019-07-19 11:36:19 +03:00
Dmitry Petrov 92984b2626 Serialize/deserialize IrFunctionExpression 2019-07-19 11:36:19 +03:00
Dmitry Petrov ffd9b45ef3 IrFunctionExpression: add 'origin'
This is actually either a LAMBDA or an ANONYMOUS_FUNCTION.
Not quite sure if it's really required, but some tools such as IR-based
decompiler might require this information.
2019-07-19 11:36:19 +03:00
Dmitry Petrov 41b59f9b9a IrFunctionExpression: update fir2ir tests 2019-07-19 11:36:19 +03:00
Dmitry Petrov ed2b4a8bec Introduce IrFunctionExpression IR element
Use it to represent proper function expressions (lambdas and anonymous
functions).
2019-07-19 11:36:18 +03:00
Vladimir Dolzhenko 022275b781 Do not invalidate package caches on generic events, KT-25264 2019-07-19 09:14:26 +02:00
Nikolay Krasko 3e9765f5bb Don't over-cache own methods list in KtUltraLightClass
The might be code that stores light class references (for example
ChangeMethodSignatureFromUsageFix) and tries to find methods
after invalidating. Internal class caches has an additional assert that
methods obtained are valid and this assert can be violated if the list
of methods was cached before some method invalidation.

This a major problem of current light-classes implementation. Other
places should be checked and fixed as well.

Check test:
QuickFixMultiFileTestGenerated$ChangeSignature$Jk.testJkKeepValOnAddingParameter1

Caused by: java.lang.AssertionError: Element: class org.jetbrains.kotlin.asJava.classes.KtUltraLightMethodForSourceDeclaration #kotlin  because: File language:Language: JAVA != Provider base language:Language: kotlin
invalidated at: no info

Attachments:

	at com.intellij.testFramework.LoggedErrorProcessor.processError(LoggedErrorProcessor.java:61)
	at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase$setUp$1.processError(KotlinLightCodeInsightFixtureTestCase.kt:84)
	at com.intellij.testFramework.TestLogger.error(TestLogger.java:40)
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:170)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:442)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1166)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:423)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:422)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:398)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:164)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:218)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:396)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:174)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.intellij.psi.PsiInvalidElementAccessException: Element: class org.jetbrains.kotlin.asJava.classes.KtUltraLightMethodForSourceDeclaration #kotlin  because: File language:Language: JAVA != Provider base language:Language: kotlin
invalidated at: no info
	at com.intellij.psi.util.PsiUtilCore.ensureValid(PsiUtilCore.java:482)
	at com.intellij.psi.impl.PsiClassImplUtil$1.add(PsiClassImplUtil.java:380)
	at com.intellij.psi.scope.processor.FilterScopeProcessor.execute(FilterScopeProcessor.java:59)
	at com.intellij.psi.impl.PsiClassImplUtil.processDeclarationsInClassNotCached(PsiClassImplUtil.java:684)
	at com.intellij.psi.impl.PsiClassImplUtil.lambda$createMembersMap$2(PsiClassImplUtil.java:395)
	at com.intellij.util.containers.ConcurrentFactoryMap$2.create(ConcurrentFactoryMap.java:181)
	at com.intellij.util.containers.ConcurrentFactoryMap.get(ConcurrentFactoryMap.java:45)
	at com.intellij.psi.impl.PsiClassImplUtil$MembersMap.get(PsiClassImplUtil.java:357)
	at com.intellij.psi.impl.PsiClassImplUtil$MembersMap.access$000(PsiClassImplUtil.java:349)
	at com.intellij.psi.impl.PsiClassImplUtil.getMap(PsiClassImplUtil.java:207)
	at com.intellij.psi.impl.PsiClassImplUtil.findByMap(PsiClassImplUtil.java:153)
	at com.intellij.psi.impl.PsiClassImplUtil.findMethodsByName(PsiClassImplUtil.java:96)
	at com.intellij.psi.impl.source.ClassInnerStuffCache.findMethodsByName(ClassInnerStuffCache.java:67)
	at org.jetbrains.kotlin.asJava.classes.KtLightClassBase.findMethodsByName(KtLightClassBase.kt:52)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.getShortText(ChangeMethodSignatureFromUsageFix.java:94)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.isAvailable(ChangeMethodSignatureFromUsageFix.java:152)
	at com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler.availableFor(ShowIntentionActionsHandler.java:127)
	at com.intellij.codeInsight.intention.impl.CachedIntentions.wrapActionsTo(CachedIntentions.java:183)
	at com.intellij.codeInsight.intention.impl.CachedIntentions.wrapAndUpdateActions(CachedIntentions.java:135)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:222)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:430)
	... 15 more
2019-07-18 22:10:20 +03:00
Nikolay Krasko 73356cbb4b Check self before complex equivalence check in light parameter 2019-07-18 22:10:20 +03:00
Nikolay Krasko 484c4ca268 Try to postpone activating decompiler from light element equivalence 2019-07-18 22:10:20 +03:00
Nikolay Krasko 9fd46c105d Reformat and cleanup in asJava/elements 2019-07-18 22:10:20 +03:00
Nikolay Krasko 353ca9752f Better validity check for kotlin light element
There're exceptions from `isWritable` method in light classes caused by
accessing invalid elements.

Override KtLightMemberImpl implementation to avoid activating
decompiler during validity check.
2019-07-18 22:10:20 +03:00
victor.petukhov 60c4eb68ff Add condition for checkNonParenthesizedAnnotationsOnFunctionalType call to except error reporting in stub mode 2019-07-18 17:34:51 +03:00
Igor Chevdar 4bad92d28c Fixed bug in LateinitLowering 2019-07-18 17:08:11 +03:00
Kirill Shmakov 407e5a5270 Use same models in MPP and CIDR 2019-07-18 15:02:17 +03:00
Stanislav Erokhin 2cc6bf31e0 Add link to license folder into README.md 2019-07-18 13:20:55 +03:00
Natalia Selezneva a2d284c769 ScriptDefinitionsManager shouldn't be ready if definitions aren't initialized yet (KT-32554)
Otherwise this can lead to wrong script definition detection on project opening
^KT-32554 Fixed
2019-07-18 12:30:03 +03:00
Natalia Selezneva e40cdef257 Scripts: pass script definition as parameter to loader (KT-32554)
This should avoid situation when script definition for file is changed between isApplicable and loadDependencies calls

^KT-32554 Fixed
2019-07-18 12:30:03 +03:00
Natalia Selezneva 763f1e8606 Scripts: check that file is non-script starting script compilation configuration update
Replace FileType check with more precise method isNonScript
2019-07-18 12:30:03 +03:00
Nikolay Krasko c14f842aa0 Fix dependency between idea core environment and jdom 2019-07-17 23:50:32 +03:00
Nikolay Krasko 20fedb040f Update 192 branch to 2019.2 BETA2 (192.5728.12) 2019-07-17 23:50:32 +03:00
Nikolay Krasko 59c5bcc11c Fix Jsr305HighlightingTest in 192 - don't ask project for not initialized fixture 2019-07-17 23:50:32 +03:00
Nikolay Krasko 9e002b3ff8 Fix inability to instantiate UsefulTestCase because of JdomSerializer
Stack Trace
	  at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:184)
	  at com.intellij.configurationStore.XmlSerializer.<clinit>(xmlSerializer.kt:15)
	  at com.intellij.codeInsight.CodeInsightSettings.writeExternal(CodeInsightSettings.java:228)
	  at com.intellij.testFramework.UsefulTestCase.<clinit>(UsefulTestCase.java:104)
	  at com.intellij.testFramework.TestLoggerFactory.log(TestLoggerFactory.java:154)
	  at com.intellij.testFramework.TestLogger.info(TestLogger.java:70)
	  at org.jetbrains.kotlin.scripting.compiler.plugin.definitions.CliScriptDependenciesProvider.calculateRefinedConfiguration(CliScriptDependenciesProvider.kt:45)
	  ...
2019-07-17 23:50:32 +03:00
Alexander Udalov 5341de253f JVM IR: run FileClass & ExpectDeclarationsRemoving phases on whole module
Since we now generate file classes even for IR loaded from dependencies
(see 3a9b94235f) to simplify code in certain lowerings, it makes sense
to do that for all source files together before any meaningful
lowerings. The easiest way to do so is to make FileClassLowering a
module-wide phase.

ExpectDeclarationsRemoveLowering is now also a module-wide phase because
it needs to be run before FileClassLowering (to avoid producing empty
facades for files that only contain `expect` declarations)
2019-07-17 18:15:02 +02:00
Alexander Udalov e867830eab JVM IR: inline JvmBackend, JvmCodegen 2019-07-17 18:15:02 +02:00
Alexander Udalov 9d639bc9a4 Minor, remove code duplication in WrappedDescriptors 2019-07-17 18:15:01 +02:00
Georgy Bronnikov 0423d0f41e JVM_IR: specify facadeClassGenerator properly in Psi2IrTranslator 2019-07-17 18:15:01 +02:00
Dmitriy Dolovov 1d3b1ed0cb CIDR: Filter aux library order entries that do not represent K/N libraries
Issue #KT-32726 Fixed
2019-07-17 22:37:42 +07:00
Dmitriy Dolovov 10b79816ab Always analyze KTS with JVM platform
Issue #KT-29953
2019-07-17 22:37:37 +07:00
Dmitriy Dolovov 80d2e2ac0d Make [Jvm|Js]IdePlatformKind and [Jvm|Js]IdePlatformKindTooling available in all IDEs
Issue #KT-29953 Fixed
2019-07-17 22:37:31 +07:00
Dmitriy Dolovov f37c81f1be Dependency on K/N platform-deps is no more required in plugin.xml 2019-07-17 22:37:25 +07:00
victor.petukhov 7ee5583c89 Fix error message for non-parenthesized annotations on functional types 2019-07-17 17:02:46 +03:00
victor.petukhov 6a679d86ab Support non-parenthesized annotations on functional types without receiver
^KT-31734 Fixed
2019-07-17 16:18:15 +03:00