Compare commits

...

129 Commits

Author SHA1 Message Date
Stanislav Erokhin
d37bb02c64 Fixed since..until in plugin.xml 2015-03-30 14:47:54 +03:00
Dmitry Jemerov
80b251ddc3 add Module.md to docs build script
(cherry picked from commit ce37ae1)
2015-03-27 16:03:55 +03:00
Dmitry Jemerov
706bb94950 add documentation for recently added packages
(cherry picked from commit bd1a116)
2015-03-27 16:03:55 +03:00
Dmitry Jemerov
2747f55832 use new structure for module.md
(cherry picked from commit 00697bf)
2015-03-27 16:03:54 +03:00
Dmitry Jemerov
893a528075 fix path mapping for source links
(cherry picked from commit de7fb22)
2015-03-27 16:03:54 +03:00
Dmitry Jemerov
e4d0288d9f fix source links in generated API docs
#KT-7062 Fixed
(cherry picked from commit 75fe342)
2015-03-27 16:03:53 +03:00
Dmitry Jemerov
bfc4c28688 change target path
(cherry picked from commit 17fddba)
2015-03-27 16:03:53 +03:00
Dmitry Jemerov
0643b944fa build script to generate standard library documentation with Dokka
(cherry picked from commit ce39a27)
2015-03-27 16:03:52 +03:00
Yan Zhulanow
aa38bbf001 Cast findViewById() result to Views safely
(cherry picked from commit 311b3cc)
2015-03-27 16:03:52 +03:00
Yan Zhulanow
6b4f1ba2e1 Add imports for XML widget tags, support.v4 fake package files
(cherry picked from commit f7400d9)
2015-03-27 16:03:52 +03:00
Yan Zhulanow
da3a41d620 Escape widget ids which are Kotlin keywords
(cherry picked from commit f0a0d36)
2015-03-27 16:03:51 +03:00
Yan Zhulanow
cdc431a694 Ignore some XML tags
(cherry picked from commit b7ce63e)
2015-03-27 16:03:51 +03:00
Yan Zhulanow
bdd344b0bf Search for all properties in layout files corresponding to the given JetProperty
(cherry picked from commit 442a469)
2015-03-27 16:03:51 +03:00
Yan Zhulanow
12ebd45361 Fix Android byte code generation inside complex expressions
(cherry picked from commit 345c34e)
2015-03-27 16:03:50 +03:00
Yan Zhulanow
52fe58564b Clear layout cache on layout XML file add/remove
(cherry picked from commit 4adb7aa)
2015-03-27 16:03:50 +03:00
Yan Zhulanow
9a6df57882 Fix null-related warnings in AndroidRenameProcessor
(cherry picked from commit bbf9213)
2015-03-27 16:03:50 +03:00
Yan Zhulanow
b25d381f80 Fix deprecated Kotlin constructs and remove unused code in Android plugins
(cherry picked from commit 3ab1e04)
2015-03-27 16:03:49 +03:00
Yan Zhulanow
c62e8edb91 Simplify Module resolving in AndroidRenameProcessor
(cherry picked from commit 369bb78)
2015-03-27 16:03:49 +03:00
Yan Zhulanow
7f7de1cbe4 Generate synthetic packages even for layouts without @+id/ attributes declared
(cherry picked from commit 8df0292)
2015-03-27 16:03:49 +03:00
Yan Zhulanow
35c81de59b Lookup XML attribute using the property (for a particular layout)
(cherry picked from commit 7fa8a98)
2015-03-27 16:03:48 +03:00
Yan Zhulanow
04d69adfb1 Fix Android layout widget redeclarations
(cherry picked from commit edc2594)
2015-03-27 16:03:48 +03:00
Yan Zhulanow
0016cd8fd6 Do not cast findViewById to View
(cherry picked from commit 2aba0a5)
2015-03-27 16:03:47 +03:00
Yan Zhulanow
71bb8c3ad2 Support special Android layout XML tags: fragment, include, merge
(cherry picked from commit ac3b978)
2015-03-27 16:03:47 +03:00
Alexey Sedunov
1968b25331 Extract Function: Do not extract extension function reference as parameter
(cherry picked from commit dcfefb0)
2015-03-27 16:03:47 +03:00
Alexey Sedunov
b09055508a Parser: Do not produce JetQualifiedExpression without receiver
#KT-7122 Fixed
(cherry picked from commit 4ec1b99)
2015-03-27 16:03:46 +03:00
Denis Zharkov
772c02679e Minor, Rename isEmpty -> isImplicit 2015-03-27 16:03:46 +03:00
Denis Zharkov
159b6e494f Change contract of getDelegationCall to @NotNull
Its existence guaranteed by parser
2015-03-27 16:03:46 +03:00
Denis Zharkov
761cc447f3 Refine recovery for constructors 2015-03-27 16:03:45 +03:00
Denis Zharkov
b9bfcc7806 Add quickfixes inserting explicit delegation calls
#KT-6963 Fixed
2015-03-27 16:03:45 +03:00
Denis Zharkov
e837ec97be Mark value arguments in case of empty delegation call
It's useful for quickfixes for these diagnostics
2015-03-27 16:03:45 +03:00
Denis Zharkov
d7551d380a Minor, always report diagnostics on callee expression
As these kinds of diagnostic always have non-empty callee expression
2015-03-27 16:03:44 +03:00
Denis Zharkov
ee2d371b6d Minor, move isEmpty, isCallToThis to JetConstructorDelegationCall 2015-03-27 16:03:44 +03:00
Denis Zharkov
9d510fac30 Do not try to detect cycles if delegation call resolution is unsuccessful 2015-03-27 16:03:44 +03:00
Denis Zharkov
e4b5fb75bd Check if element is valid before checking it's writable
Otherwise it may lead to exception
2015-03-27 16:03:43 +03:00
Denis Zharkov
7f6b9b0a92 Unify reporting resolution errors for empty delegation calls
- Always report "There is no applicable constructor for call without arguments in superclass"
  under `constructor` keyword by replacing default TracingStrategy
- Remove positioning strategy used for reporting non-applicable
  for empty delegation calls

 #KT-6971 Fixed
2015-03-27 16:03:43 +03:00
Denis Zharkov
e7f3d724bb Add test case: 'platformStatic' on constructors 2015-03-27 16:03:43 +03:00
Denis Zharkov
2a2d9cb668 Prohibit 'native' annotation on constructors
Currently doesn't work for primary ones

 #KT-7000 Fixed
2015-03-27 16:03:42 +03:00
Denis Zharkov
5664bbbd55 Report illegal modifiers on secondary constructors 2015-03-27 16:03:42 +03:00
Denis Zharkov
5a21ce77ed Prohibit platformName on secondary constructor
#KT-6999 Fixed
2015-03-27 16:03:42 +03:00
Denis Zharkov
43cde13461 Report error for inappropriate modifiers usages 2015-03-27 16:03:41 +03:00
Denis Zharkov
5d62b11542 Allow secondary constructors without body
#KT-6967 Fixed
2015-03-27 16:03:41 +03:00
Yan Zhulanow
ce6616859f Replicate IDEA plugin versions only on TeamCity build 2015-03-27 16:03:41 +03:00
Stanislav Erokhin
7d15cfa60e Fixed formatter for function expression 2015-03-27 16:03:40 +03:00
Stanislav Erokhin
de8396f635 Fix JetTreeVisitor for file case 2015-03-27 16:03:40 +03:00
Stanislav Erokhin
e6a325af6c Migrate AddInitKeywordFix & ClassObjectToDefaultObjectFix to JetWholeProjectModalAction 2015-03-27 16:03:40 +03:00
Stanislav Erokhin
993fe489e0 Create DeprecatedLambdaSyntaxFix for whole project 2015-03-27 16:03:39 +03:00
Stanislav Erokhin
548e4744ae Minor. Divide method moveInsideParenthesesAndReplaceWith 2015-03-27 16:03:39 +03:00
Michael Nedzelsky
1d23bad452 merge serialization.js module into js.serializer 2015-03-27 16:03:39 +03:00
Michael Nedzelsky
62d58303f2 fix EA-66819 - IOE: VirtualDirectoryImpl.contentsToByteArray
Changes: do not try to read content for virtual file in case it is really a directory
2015-03-27 16:03:38 +03:00
Alexey Tsvetkov
c46e04c326 JS: added test for callable reference as stdlib inline function argument
(cherry picked from commit 03f0c6e)
2015-03-27 16:03:38 +03:00
Alexey Tsvetkov
d5f3bad0f5 JS: fix issues with js() usage in inline functions
(cherry picked from commit 1557111)
2015-03-27 16:03:38 +03:00
Alexey Tsvetkov
a2eb86f467 JS: report error when js() produces empty AST
(cherry picked from commit 5ff5cea)
2015-03-27 16:03:37 +03:00
Alexey Tsvetkov
a3e9abff59 JS: generate shorter tag for inline functions
(cherry picked from commit eb4f6b8)
2015-03-27 16:03:37 +03:00
Alexey Tsvetkov
bd398168b4 JS: removed comma expression decomposition from InlineMetadata
There are used to be two inline tags (corresponding to start, end of inline function).
An expression like "startTag, function, endTag" was parsed into comma expression, then decomposed.
Now, it's just one tag at start, and parser can read function, then stop.
Thus, there is no need to decompose comma expressions.
(cherry picked from commit 8be3628)
2015-03-27 16:03:37 +03:00
Alexey Tsvetkov
cd0424ad4c JS: use one tag for inlining
(cherry picked from commit c7e8f52)
2015-03-27 16:03:36 +03:00
Alexey Tsvetkov
0c28eb16ac JS: renamed JsParser->JsAstMapper
(cherry picked from commit e83b253)
2015-03-27 16:03:36 +03:00
Alexey Tsvetkov
cb68f5c516 JS: added tests for recursion cycle in inline functions
(cherry picked from commit b5797eb)
2015-03-27 16:03:36 +03:00
Alexey Tsvetkov
fe95b314e8 JS: report error from backend, when inline function is called recursively
(cherry picked from commit 24f2121)
2015-03-27 16:03:35 +03:00
Zalim Bashorov
556742f41f JS frontend: added diagnostic about secondary constructors not supported yet.
(cherry picked from commit d569ea5)
2015-03-27 16:03:35 +03:00
Michael Nedzelsky
11c0f499f8 fix navigation is Kotlin/Java with Kotlin/Javascript modules
(cherry picked from commit d01cc8a)
2015-03-27 16:03:35 +03:00
Zalim Bashorov
5e443d6e5b Minor: fix testdata
(cherry picked from commit 1b53088)
2015-03-27 16:03:34 +03:00
Zalim Bashorov
5874c4cc33 JS frontend: added diagnostic about non-toplevel classifiers are unsupported yet.
(cherry picked from commit aaa7f6d)
2015-03-27 16:03:34 +03:00
Zalim Bashorov
117828553a Minor in JS frontend: fix compiler warnings.
(cherry picked from commit 1bf7610)
2015-03-27 16:03:34 +03:00
Zalim Bashorov
67b0c4b114 Minor in JS frontend: extract native annotation checkers to separate file.
(cherry picked from commit 68619be)
2015-03-27 16:03:33 +03:00
Zalim Bashorov
0b30d9432c AnnotationChecker -> DeclarationChecker
(cherry picked from commit 8673f95)
2015-03-27 16:03:33 +03:00
Alexey Sedunov
6bdf294512 Find Usages: Support of secondary constructors and delegation calls
(cherry picked from commit d19e633)
2015-03-27 16:03:33 +03:00
Alexey Sedunov
96ebf81ba4 Call Hierarchy: Support secondary constructors
(cherry picked from commit 312a1db)
2015-03-27 16:03:32 +03:00
Alexey Sedunov
f04e81f089 References Search: Add extension which looks for constructor usages in delegation calls
(cherry picked from commit fe553ed)
2015-03-27 16:03:32 +03:00
Alexey Sedunov
08c9253b65 Safe Delete: Support secondary constructors
(cherry picked from commit b45965b)
2015-03-27 16:03:32 +03:00
Alexey Sedunov
75aae4f9bf Safe Delete: Add test for primary constructor with usages in delegation calls
(cherry picked from commit cefd8b4)
2015-03-27 16:03:31 +03:00
Alexey Sedunov
a7aea172b1 Fix retrieval of class constructor
(cherry picked from commit 83e23aa)
2015-03-27 16:03:31 +03:00
Alexey Sedunov
6ffbf7f562 Change Signature: Support refactoring of primary/secondary constructor by delegation call reference
(cherry picked from commit 5c7debb)
2015-03-27 16:03:31 +03:00
Alexey Sedunov
7dc23f4c03 Change Signature: Add tests for secondary constructors and delegation calls
(cherry picked from commit 173a28a)
2015-03-27 16:03:30 +03:00
Yan Zhulanow
b0dc27b6a0 Remove comment about IDEA version change (not needed in release branches, fix merge) 2015-03-27 16:03:30 +03:00
Yan Zhulanow
00d9f47dd3 Replicate idea-version from the main plugin.xml to the android-idea-plugin plugin.xml 2015-03-27 16:03:28 +03:00
Alexander Udalov
fe46a6daf3 Improve built-in initialization error message 2015-03-27 16:02:58 +03:00
Dmitry Jemerov
d632728b62 correct indentation after pressing Enter in KDoc tag
#KT-7044 Fixed
2015-03-27 16:02:58 +03:00
Alexander Udalov
c7e3ecd45f Don't create KProperty instance for synthetic field
#KT-5759 Fixed
2015-03-27 16:02:58 +03:00
Alexander Udalov
2b749ad8b5 Fix KClass.simpleName for local classes 2015-03-27 16:02:57 +03:00
Alexander Udalov
ca37e22b77 Do not report "no reflection" inspection in JS modules
#KT-7087 Fixed
2015-03-27 16:02:57 +03:00
Alexander Udalov
1a21436705 Do not report "no reflection" inspection where reflection is not used
#KT-7059 Fixed
2015-03-27 16:02:57 +03:00
Evgeny Gerashchenko
53af13e114 Enabled "Invert if condition" intention. It was erroneously disabled one year ago. 2015-03-27 16:02:56 +03:00
Evgeny Gerashchenko
e7665a2a86 KT-7021 Don't mark companion object as unused if some stuff from it is used
#KT-7021 fixed
2015-03-27 16:02:56 +03:00
Evgeny Gerashchenko
2cd7efed42 Finding implicit usages of companion object in containing class. 2015-03-27 16:02:56 +03:00
Stanislav Erokhin
208badc680 Merge remote-tracking branch 'origin/master' into release/br139 2015-03-18 21:54:53 +03:00
Nikolay Krasko
9a44f39d66 Revert: Switch to the new(right) API for register extension points and extensions. (5e782dd547)
Conflicts:
	compiler/cli/src/com/intellij/ide/plugins/PluginManagerCoreProxy.java
2015-03-18 16:14:46 +03:00
Nikolay Krasko
2ea442b8b1 Add absent LightVirtualFileBase and BinaryLightVirtualFile 2015-03-18 15:53:39 +03:00
Nikolay Krasko
dd1332e6ff Merge with tag 0.11.65 2015-03-18 15:53:19 +03:00
Nikolay Krasko
d7273bdf07 Revert "Minor. Replaced usage of deprecated method."
This reverts commit 70a925317a.
2015-03-17 16:00:12 +03:00
Nikolay Krasko
046298084c Merge tag 'build-0.11.8' into idea_continuous/br139 2015-03-17 15:09:51 +03:00
teamcityserver
ef82fda54b Auto-merge with tag build-0.10.1494 2015-03-16 18:53:08 +03:00
teamcityserver
3109b2acba Auto-merge with tag build-0.10.1490 2015-03-16 17:38:33 +03:00
teamcityserver
a5c05e30b7 Auto-merge with tag build-0.10.1486 2015-03-16 12:17:14 +03:00
teamcityserver
ce04b620a6 Auto-merge with tag build-0.10.1478 2015-03-14 19:05:39 +03:00
teamcityserver
54711e803b Auto-merge with tag build-0.10.1474 2015-03-14 02:29:05 +03:00
teamcityserver
918f0a2d11 Auto-merge with tag build-0.10.1470 2015-03-13 20:53:25 +03:00
teamcityserver
567f37f446 Auto-merge with tag build-0.10.1464 2015-03-13 19:20:42 +03:00
teamcityserver
10e520eb52 Auto-merge with tag build-0.10.1453 2015-03-13 06:22:06 +03:00
teamcityserver
a5a124cdb7 Auto-merge with tag build-0.10.1445 2015-03-13 02:02:45 +03:00
teamcityserver
b901a7794d Auto-merge with tag build-0.10.1438 2015-03-12 23:49:14 +03:00
teamcityserver
4b62494c1e Auto-merge with tag build-0.10.1435 2015-03-12 19:54:36 +03:00
teamcityserver
ac546e8c7d Auto-merge with tag build-0.10.1433 2015-03-12 19:24:30 +03:00
teamcityserver
586e1cea9d Auto-merge with tag build-0.10.1426 2015-03-12 17:45:28 +03:00
teamcityserver
fecc6f309a Auto-merge with tag build-0.10.1425 2015-03-12 17:36:37 +03:00
Nikolay Krasko
4a0b214606 Revert to old findChildByType() signature 2015-03-12 15:23:16 +03:00
teamcityserver
172d000e62 Auto-merge with tag build-0.10.1419 2015-03-12 13:25:25 +03:00
teamcityserver
3f9d407b06 Auto-merge with tag build-0.10.1410 2015-03-12 02:33:37 +03:00
teamcityserver
a59aac0af1 Auto-merge with tag build-0.10.1407 2015-03-12 00:50:29 +03:00
teamcityserver
0a9fbb6905 Auto-merge with tag refs/heads/master 2015-03-11 18:17:09 +03:00
Evgeny Gerashchenko
094580c660 Merge pull request #596 from JetBrains/fix-since-build-br139
fixed 'since-build' attribute
2015-03-11 11:39:12 +03:00
Nikolay Chashnikov
e79fbabc7a fixed 'since-build' attribute
It makes no sense to include attempt number in 'since/until-build' attributes because only one of these builds is publicly available, also the attempt number in these attributes currently confuses Plugin Verifier.
2015-03-11 10:27:22 +03:00
teamcityserver
2a317524cf Buildserver auto merge 2015-03-10 21:55:07 +03:00
teamcityserver
97b2e90da5 Buildserver auto merge 2015-03-10 19:46:22 +03:00
teamcityserver
028b1c0470 Buildserver auto merge 2015-03-10 18:31:51 +03:00
teamcityserver
a0feee9222 Buildserver auto merge 2015-03-10 17:58:47 +03:00
teamcityserver
3e8faf9cda Buildserver auto merge 2015-03-10 14:35:06 +03:00
teamcityserver
57f7c24b64 Buildserver auto merge 2015-03-07 16:57:03 +03:00
teamcityserver
d8fe181d87 Buildserver auto merge 2015-03-06 23:16:15 +03:00
teamcityserver
3eda5e6e9f Buildserver auto merge 2015-03-06 22:22:37 +03:00
Nikolay Krasko
98a8ee7e39 Test fix 2015-03-06 21:34:15 +03:00
Nikolay Krasko
2b5151ee8b Merge tag 'build-0.10.1316' into idea_continuous/br139
Conflicts:
	idea/src/META-INF/plugin.xml
2015-03-06 19:37:24 +03:00
Nikolay Krasko
d11fa41d93 Merge tag 'build-0.10.1306' into rr/idea_14.0
Conflicts:
	idea/src/META-INF/plugin.xml
	update_dependencies.xml
	DirectiveBasedActionUtils.java
	KotlinAndroidTestCase.java
2015-03-06 17:45:07 +03:00
Nikolay Krasko
281d45239d Merge tag 'build-0.10.1292' into rr/idea_14.0
Conflicts:
	update_dependencies.xml
2015-03-06 16:18:45 +03:00
Nikolay Krasko
5462cb2a04 Update to 139.1408.1 2015-02-25 21:32:54 +03:00
Evgeny Gerashchenko
72c05b45a0 Fixed test data according to fixed bug in IDEA JPS. 2015-02-25 21:32:54 +03:00
Nikolay Krasko
e0de5cb50b Now PsiElementFinderImpl is registered via extension but it hadn't been added to JavaCoreProjectEnvironment
(cherry picked from commit fb72c07)
2015-02-25 21:32:53 +03:00
teamcity
43685a1d6f Auto-merge with tag refs/tags/build-0.10.1094 2015-02-25 15:20:44 +03:00
Nikolay Krasko
665e0db548 Merge remote-tracking branch 'origin/master' into rr/idea_14.0
Conflicts:
	idea/src/META-INF/plugin.xml
2015-02-18 19:26:50 +03:00
Nikolay Krasko
37c5ec7c7c Restrict until-build version with 139 branch 2015-02-18 19:11:02 +03:00
446 changed files with 6749 additions and 1543 deletions

1
.idea/ant.xml generated
View File

@@ -13,5 +13,6 @@
</buildFile>
<buildFile url="file://$PROJECT_DIR$/pluginPublisher/TeamCityPluginPublisher.xml" />
<buildFile url="file://$PROJECT_DIR$/idea-runner/runner.xml" />
<buildFile url="file://$PROJECT_DIR$/replicate_versions.xml" />
</component>
</project>

View File

@@ -26,7 +26,6 @@
<element id="module-output" name="idea-jps-common" />
<element id="module-output" name="preloader" />
<element id="module-output" name="serialization" />
<element id="module-output" name="serialization.js" />
<element id="module-output" name="serialization.jvm" />
<element id="module-output" name="backend-common" />
<element id="library" level="project" name="builtins" />
@@ -40,6 +39,7 @@
<element id="module-output" name="ide-common" />
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
<element id="module-output" name="kotlin-android-plugin" />
<element id="module-output" name="js.serializer" />
</element>
<element id="library" level="project" name="javax.inject" />
<element id="directory" name="jps">

1
.idea/modules.xml generated
View File

@@ -49,7 +49,6 @@
<module fileurl="file://$PROJECT_DIR$/core/reflection.jvm/reflection.jvm.iml" filepath="$PROJECT_DIR$/core/reflection.jvm/reflection.jvm.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/runtime.jvm/runtime.jvm.iml" filepath="$PROJECT_DIR$/core/runtime.jvm/runtime.jvm.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/serialization/serialization.iml" filepath="$PROJECT_DIR$/core/serialization/serialization.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/serialization.js/serialization.js.iml" filepath="$PROJECT_DIR$/core/serialization.js/serialization.js.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/core/serialization.jvm/serialization.jvm.iml" filepath="$PROJECT_DIR$/core/serialization.jvm/serialization.jvm.iml" group="core" />
<module fileurl="file://$PROJECT_DIR$/compiler/util/util.iml" filepath="$PROJECT_DIR$/compiler/util/util.iml" />
<module fileurl="file://$PROJECT_DIR$/core/util.runtime/util.runtime.iml" filepath="$PROJECT_DIR$/core/util.runtime/util.runtime.iml" group="core" />

View File

@@ -1,5 +1,6 @@
<project name="Jet CI Steps" default="none">
<import file="build.xml" optional="false"/>
<import file="replicate_versions.xml" optional="false"/>
<property name="build.number" value="snapshot"/>
<property name="jdk16.home" value="${java.home}"/>
@@ -12,6 +13,10 @@
<property name="plugin.xml.bk" value="${version_substitute_dir}/plugin.xml.bk"/>
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned" />
<property name="android-extensions.plugin.xml" value="plugins/android-idea-plugin/src/META-INF/plugin.xml"/>
<property name="android-extensions.plugin.xml.bk" value="${version_substitute_dir}/kotlin-android-extensions.plugin.xml.bk"/>
<property name="android-extensions.plugin.xml.versioned" value="${android-extensions.plugin.xml}.versioned" />
<property name="compiler.version.java" value="compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/KotlinVersion.java"/>
<property name="compiler.version.java.bk" value="${version_substitute_dir}/KotlinVersion.java.bk"/>
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned" />
@@ -82,15 +87,24 @@
target.file.versioned="${plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
<substituteVersionInFile
target.file="${android-extensions.plugin.xml}"
target.file.bk="${android-extensions.plugin.xml.bk}"
target.file.versioned="${android-extensions.plugin.xml.versioned}"
test.string="&lt;version&gt;@snapshot@&lt;/version&gt;"/>
<substituteVersionInFile
target.file="${compiler.version.java}"
target.file.bk="${compiler.version.java.bk}"
target.file.versioned="${compiler.version.java.versioned}"
test.string="public static final String VERSION = &quot;@snapshot@&quot;;"/>
<replicateIdeaVersion target.file="${android-extensions.plugin.xml}" />
</target>
<target name="revertTemplateFiles">
<copy file="${plugin.xml.bk}" tofile="${plugin.xml}" overwrite="true"/>
<copy file="${android-extensions.plugin.xml.bk}" tofile="${android-extensions.plugin.xml}" overwrite="true"/>
<copy file="${compiler.version.java.bk}" tofile="${compiler.version.java}" overwrite="true"/>
<delete dir="${version_substitute_dir}" quiet="true"/>

View File

@@ -99,7 +99,6 @@
<include name="core/descriptors/src"/>
<include name="core/serialization/src"/>
<include name="core/descriptor.loader.java/src"/>
<include name="core/serialization.js/src"/>
<include name="core/serialization.jvm/src"/>
<include name="core/util.runtime/src"/>
<include name="compiler/frontend/src"/>
@@ -127,7 +126,6 @@
<include name="serialization/**"/>
<include name="descriptor.loader.java/**"/>
<include name="frontend.java/**"/>
<include name="serialization.js/**"/>
<include name="serialization.jvm/**"/>
<include name="backend/**"/>
<include name="backend-common/**"/>
@@ -194,7 +192,6 @@
<fileset dir="core/descriptors/src"/>
<fileset dir="core/descriptor.loader.java/src"/>
<fileset dir="core/serialization/src"/>
<fileset dir="core/serialization.js/src"/>
<fileset dir="core/serialization.jvm/src"/>
<fileset dir="core/util.runtime/src"/>
<fileset dir="compiler/frontend/src"/>

View File

@@ -1913,8 +1913,9 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
ExpressionCodegenExtension.Context context = new ExpressionCodegenExtension.Context(typeMapper, v);
JetType returnType = propertyDescriptor.getReturnType();
for (ExpressionCodegenExtension extension : codegenExtensions) {
if (returnType != null && extension.apply(receiver, resolvedCall, context)) {
return StackValue.onStack(typeMapper.mapType(returnType));
if (returnType != null) {
StackValue value = extension.applyProperty(receiver, resolvedCall, context);
if (value != null) return value;
}
}
}
@@ -2352,7 +2353,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (!codegenExtensions.isEmpty()) {
ExpressionCodegenExtension.Context context = new ExpressionCodegenExtension.Context(typeMapper, v);
for (ExpressionCodegenExtension extension : codegenExtensions) {
if (extension.apply(receiver, resolvedCall, context)) return;
if (extension.applyFunction(receiver, resolvedCall, context)) return;
}
}

View File

@@ -1176,7 +1176,9 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
JetSecondaryConstructor constructor =
(JetSecondaryConstructor) DescriptorToSourceUtils.descriptorToDeclaration(constructorDescriptor);
assert constructor != null;
codegen.gen(constructor.getBodyExpression(), Type.VOID_TYPE);
if (constructor.hasBody()) {
codegen.gen(constructor.getBodyExpression(), Type.VOID_TYPE);
}
iv.visitInsn(RETURN);
}

View File

@@ -35,9 +35,17 @@ public trait ExpressionCodegenExtension {
public val v: InstructionAdapter
)
// Function is responsible to put the value on stack by itself.
// Returns false if not applicable, and if stack was not modified.
public fun apply(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): Boolean
/**
* Used for generating custom byte code for the property value obtain. This function has lazy semantics.
* Returns new stack value.
*/
public fun applyProperty(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): StackValue? = null
/**
* Used for generating custom byte code for the function call. This function has non-lazy semantics.
* Returns true if the stack was modified.
*/
public fun applyFunction(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): Boolean = false
public fun generateClassSyntheticParts(
classBuilder: ClassBuilder,

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.plugins;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.List;
import java.util.Set;
// TODO drop this temporary hack to access to PluginManagerCore methods when CoreApplicationEnvironment got similar features.
public class PluginManagerCoreProxy {
private PluginManagerCoreProxy() {}
@Nullable
public static IdeaPluginDescriptorImpl loadDescriptorFromDir(@NotNull File file, @NotNull String fileName) {
return PluginManagerCore.loadDescriptorFromDir(file, fileName);
}
@Nullable
public static IdeaPluginDescriptorImpl loadDescriptorFromJar(@NotNull File file, @NotNull String fileName) {
return PluginManagerCore.loadDescriptorFromJar(file, fileName);
}
// copied as is from PluginManagerCore#registerExtensionPointsAndExtensions
public static void registerExtensionPointsAndExtensions(ExtensionsArea area, List<IdeaPluginDescriptorImpl> loadedPlugins) {
for (IdeaPluginDescriptorImpl descriptor : loadedPlugins) {
descriptor.registerExtensionPoints(area);
}
Set<String> epNames = ContainerUtil.newHashSet();
for (ExtensionPoint point : area.getExtensionPoints()) {
epNames.add(point.getName());
}
for (IdeaPluginDescriptorImpl descriptor : loadedPlugins) {
for (String epName : epNames) {
descriptor.registerExtensions(area, epName);
}
}
}
}

View File

@@ -17,46 +17,35 @@
package org.jetbrains.kotlin.cli.jvm.compiler;
import com.google.common.collect.Sets;
import com.intellij.codeInsight.ContainerProvider;
import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.codeInsight.runner.JavaMainMethodProvider;
import com.intellij.core.CoreApplicationEnvironment;
import com.intellij.core.CoreJavaFileManager;
import com.intellij.core.JavaCoreApplicationEnvironment;
import com.intellij.core.JavaCoreProjectEnvironment;
import com.intellij.ide.plugins.IdeaPluginDescriptorImpl;
import com.intellij.ide.plugins.PluginManagerCoreProxy;
import com.intellij.lang.java.JavaParserDefinition;
import com.intellij.mock.MockApplication;
import com.intellij.mock.MockProject;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileTypes.ContentBasedFileSubstitutor;
import com.intellij.openapi.fileTypes.FileTypeExtensionPoint;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.FileContextProvider;
import com.intellij.psi.PsiElementFinder;
import com.intellij.psi.PsiManager;
import com.intellij.psi.augment.PsiAugmentProvider;
import com.intellij.psi.compiled.ClassFileDecompilers;
import com.intellij.psi.impl.PsiElementFinderImpl;
import com.intellij.psi.impl.PsiTreeChangePreprocessor;
import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy;
import com.intellij.psi.impl.compiled.ClsStubBuilderFactory;
import com.intellij.psi.impl.file.impl.JavaFileManager;
import com.intellij.psi.meta.MetaDataContributor;
import com.intellij.psi.stubs.BinaryFileStubBuilders;
import com.intellij.util.containers.ContainerUtil;
import kotlin.Function1;
import kotlin.Unit;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension;
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider;
import org.jetbrains.kotlin.asJava.JavaElementFinder;
import org.jetbrains.kotlin.asJava.KotlinLightClassForPackage;
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport;
@@ -65,11 +54,9 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation;
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity;
import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
import org.jetbrains.kotlin.cli.jvm.JVMConfigurationKeys;
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension;
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar;
import org.jetbrains.kotlin.config.CommonConfigurationKeys;
import org.jetbrains.kotlin.config.CompilerConfiguration;
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider;
import org.jetbrains.kotlin.idea.JetFileType;
import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache;
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory;
@@ -170,8 +157,6 @@ public class JetCoreEnvironment {
@NotNull CompilerConfiguration configuration,
@NotNull List<String> configFilePaths
) {
Extensions.cleanRootArea(parentDisposable);
registerAppExtensionPoints();
JavaCoreApplicationEnvironment applicationEnvironment = new JavaCoreApplicationEnvironment(parentDisposable);
for (String configPath : configFilePaths) {
@@ -184,39 +169,23 @@ public class JetCoreEnvironment {
return applicationEnvironment;
}
private static void registerAppExtensionPoints() {
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContentBasedFileSubstitutor.EP_NAME, ContentBasedFileSubstitutor.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), FileContextProvider.EP_NAME, FileContextProvider.class);
//
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), MetaDataContributor.EP_NAME, MetaDataContributor.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsStubBuilderFactory.EP_NAME, ClsStubBuilderFactory.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);
//
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME, ContainerProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME, ClsCustomNavigationPolicy.class);
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME,
ClassFileDecompilers.Decompiler.class);
}
private static void registerApplicationExtensionPointsAndExtensionsFrom(@NotNull CompilerConfiguration configuration, @NotNull String configFilePath) {
IdeaPluginDescriptorImpl descriptor;
CompilerJarLocator locator = configuration.get(JVMConfigurationKeys.COMPILER_JAR_LOCATOR);
File pluginRoot = locator == null ? PathUtil.getPathUtilJar() : locator.getCompilerJar();
Application app = ApplicationManager.getApplication();
File parentFile = pluginRoot.getParentFile();
if (pluginRoot.isDirectory() &&
app != null && app.isUnitTestMode() &&
FileUtil.toCanonicalPath(parentFile.getPath()).endsWith("out/production")
) {
File jar = locator == null ? PathUtil.getPathUtilJar() : locator.getCompilerJar();
if (jar.isFile()) {
descriptor = PluginManagerCoreProxy.loadDescriptorFromJar(jar, configFilePath);
}
else {
// hack for load extensions when compiler run directly from out directory(e.g. in tests)
File srcDir = parentFile.getParentFile().getParentFile();
pluginRoot = new File(srcDir, "idea/src");
File srcDir = jar.getParentFile().getParentFile().getParentFile();
File pluginDir = new File(srcDir, "idea/src");
descriptor = PluginManagerCoreProxy.loadDescriptorFromDir(pluginDir, configFilePath);
}
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea());
assert descriptor != null : "Can not load descriptor from " + configFilePath + " relative to " + jar;
PluginManagerCoreProxy.registerExtensionPointsAndExtensions(Extensions.getRootArea(), Collections.singletonList(descriptor));
}
private static void registerApplicationServicesForCLI(@NotNull JavaCoreApplicationEnvironment applicationEnvironment) {
@@ -251,12 +220,7 @@ public class JetCoreEnvironment {
this.configuration = configuration.copy();
this.configuration.setReadOnly(true);
projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment){
@Override
protected void preregisterServices() {
registerProjectExtensionPoints(Extensions.getArea(getProject()));
}
};
projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment);
MockProject project = projectEnvironment.getProject();
annotationsManager = new CoreExternalAnnotationsManager(project.getComponent(PsiManager.class));
@@ -307,11 +271,6 @@ public class JetCoreEnvironment {
}
}
private static void registerProjectExtensionPoints(ExtensionsArea area) {
CoreApplicationEnvironment.registerExtensionPoint(area, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class);
CoreApplicationEnvironment.registerExtensionPoint(area, PsiElementFinder.EP_NAME, PsiElementFinder.class);
}
// made public for Upsource
public static void registerProjectServices(@NotNull JavaCoreProjectEnvironment projectEnvironment) {
MockProject project = projectEnvironment.getProject();

View File

@@ -26,9 +26,6 @@ abstract class JavaAnnotationArgumentImpl(
class object Factory {
fun create(argument: PsiAnnotationMemberValue, name: Name?): JavaAnnotationArgument {
val value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument)
if (value is Enum<*>) {
return JavaEnumValueAnnotationArgumentImpl(argument as PsiReferenceExpression, name)
}
if (value != null || argument is PsiLiteralExpression) {
return JavaLiteralAnnotationArgumentImpl(name, value)
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.load.kotlin
import org.jetbrains.kotlin.resolve.AdditionalCheckerProvider
import org.jetbrains.kotlin.resolve.AnnotationChecker
import org.jetbrains.kotlin.resolve.DeclarationChecker
import org.jetbrains.kotlin.resolve.annotations.hasPlatformStaticAnnotation
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.descriptors.ClassKind
@@ -59,12 +59,12 @@ import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.types.expressions.SenselessComparisonChecker
public object KotlinJvmCheckerProvider : AdditionalCheckerProvider(
additionalAnnotationCheckers = listOf(PlatformStaticAnnotationChecker(), LocalFunInlineChecker(), ReifiedTypeParameterAnnotationChecker(), NativeFunChecker()),
additionalDeclarationCheckers = listOf(PlatformStaticAnnotationChecker(), LocalFunInlineChecker(), ReifiedTypeParameterAnnotationChecker(), NativeFunChecker()),
additionalCallCheckers = listOf(NeedSyntheticChecker()),
additionalTypeCheckers = listOf(JavaNullabilityWarningsChecker())
)
public class LocalFunInlineChecker : AnnotationChecker {
public class LocalFunInlineChecker : DeclarationChecker {
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
if (descriptor.hasInlineAnnotation() &&
@@ -76,7 +76,7 @@ public class LocalFunInlineChecker : AnnotationChecker {
}
}
public class PlatformStaticAnnotationChecker : AnnotationChecker {
public class PlatformStaticAnnotationChecker : DeclarationChecker {
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
if (descriptor.hasPlatformStaticAnnotation()) {
@@ -116,7 +116,7 @@ public class PlatformStaticAnnotationChecker : AnnotationChecker {
}
}
public class ReifiedTypeParameterAnnotationChecker : AnnotationChecker {
public class ReifiedTypeParameterAnnotationChecker : DeclarationChecker {
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
if (descriptor.hasIntrinsicAnnotation()) return

View File

@@ -17,13 +17,15 @@
package org.jetbrains.kotlin.load.kotlin.nativeDeclarations
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.AnnotationChecker
import org.jetbrains.kotlin.resolve.DeclarationChecker
import org.jetbrains.kotlin.psi.JetDeclaration
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
import org.jetbrains.kotlin.psi.JetDeclarationWithBody
import org.jetbrains.kotlin.resolve.annotations.hasInlineAnnotation
@@ -38,7 +40,7 @@ public fun DeclarationDescriptor.hasNativeAnnotation(): Boolean {
public class SuppressNoBodyErrorsForNativeDeclarations : SuppressDiagnosticsByAnnotations(FUNCTION_NO_BODY_ERRORS, NATIVE_ANNOTATION_CLASS_NAME)
public class NativeFunChecker : AnnotationChecker {
public class NativeFunChecker : DeclarationChecker {
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
if (!descriptor.hasNativeAnnotation()) return
@@ -50,7 +52,10 @@ public class NativeFunChecker : AnnotationChecker {
diagnosticHolder.report(ErrorsJvm.NATIVE_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration))
}
if (declaration is JetDeclarationWithBody && declaration.hasBody()) {
if (descriptor is ConstructorDescriptor) {
diagnosticHolder.report(Errors.INAPPLICABLE_ANNOTATION.on(declaration));
}
else if (declaration is JetDeclarationWithBody && declaration.hasBody()) {
diagnosticHolder.report(ErrorsJvm.NATIVE_DECLARATION_CANNOT_HAVE_BODY.on(declaration))
}

View File

@@ -26,10 +26,7 @@ import com.intellij.openapi.roots.PackageIndex;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElementFinder;
import com.intellij.psi.PsiManager;
import com.intellij.psi.PsiPackage;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiElementFinderImpl;
import com.intellij.psi.impl.file.PsiPackageImpl;
import com.intellij.psi.impl.file.impl.JavaFileManager;
@@ -39,7 +36,7 @@ import com.intellij.reference.SoftReference;
import com.intellij.util.CommonProcessors;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.Query;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.ConcurrentHashMap;
import com.intellij.util.messages.MessageBus;
import kotlin.Function1;
import kotlin.KotlinPackage;
@@ -54,8 +51,10 @@ public class KotlinJavaPsiFacade {
private volatile KotlinPsiElementFinderWrapper[] elementFinders;
private static class PackageCache {
final ConcurrentMap<Pair<String, GlobalSearchScope>, PsiPackage> packageInScopeCache = ContainerUtil.newConcurrentMap();
final ConcurrentMap<String, Boolean> hasPackageInAllScopeCache = ContainerUtil.newConcurrentMap();
final ConcurrentMap<Pair<String, GlobalSearchScope>, PsiPackage> packageInScopeCache =
new ConcurrentHashMap<Pair<String, GlobalSearchScope>, PsiPackage>();
final ConcurrentMap<String, Boolean> hasPackageInAllScopeCache =
new ConcurrentHashMap<String, Boolean>();
}
private volatile SoftReference<PackageCache> packageCache;
@@ -88,9 +87,10 @@ public class KotlinJavaPsiFacade {
}
public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
ProgressIndicatorProvider.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly
ProgressIndicatorProvider.checkCanceled();
if (shouldUseSlowResolve()) {
// TODO: Update in IDEA 14
if (DumbService.getInstance(getProject()).isDumb()) {
PsiClass[] classes = findClassesInDumbMode(qualifiedName, scope);
if (classes.length != 0) {
return classes[0];
@@ -127,11 +127,6 @@ public class KotlinJavaPsiFacade {
return pkg.findClassByShortName(className, scope);
}
private boolean shouldUseSlowResolve() {
DumbService dumbService = DumbService.getInstance(getProject());
return dumbService.isDumb() && dumbService.isAlternativeResolveEnabled();
}
@NotNull
private KotlinPsiElementFinderWrapper[] finders() {
KotlinPsiElementFinderWrapper[] answer = elementFinders;

View File

@@ -1441,10 +1441,7 @@ public class JetControlFlowProcessor {
processParameters(constructor.getValueParameters());
generateCallOrMarkUnresolved(constructor.getDelegationCall());
if (constructor.getDelegationCall() != null &&
constructor.getDelegationCall().getCalleeExpression() != null &&
!constructor.getDelegationCall().getCalleeExpression().isThis()
) {
if (!constructor.getDelegationCall().isCallToThis()) {
generateClassOrObjectInitializers(classOrObject);
}

View File

@@ -155,8 +155,7 @@ public interface Errors {
// Secondary constructors
DiagnosticFactory0<JetConstructorDelegationCall> CYCLIC_CONSTRUCTOR_DELEGATION_CALL =
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
DiagnosticFactory0<JetConstructorDelegationReferenceExpression> CYCLIC_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetSecondaryConstructor> SECONDARY_CONSTRUCTOR_IN_OBJECT = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetDelegatorToSuperCall> SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);
@@ -165,10 +164,12 @@ public interface Errors {
DiagnosticFactory0<JetConstructorDelegationCall> PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED =
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
DiagnosticFactory0<JetConstructorDelegationCall> DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR =
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
DiagnosticFactory0<JetConstructorDelegationReferenceExpression> DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR =
DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<JetConstructorDelegationCall> EXPLICIT_DELEGATION_CALL_REQUIRED =
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
// Trait-specific
@@ -411,8 +412,7 @@ public interface Errors {
DiagnosticFactory0<JetExpression> NOT_A_CLASS = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> OVERLOAD_RESOLUTION_AMBIGUITY = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> NONE_APPLICABLE =
DiagnosticFactory1.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL_OR_DEFAULT);
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> NONE_APPLICABLE = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> CANNOT_COMPLETE_RESOLVE = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> UNRESOLVED_REFERENCE_WRONG_RECEIVER = DiagnosticFactory1.create(ERROR);

View File

@@ -62,6 +62,9 @@ public object PositioningStrategies {
element.getNameIdentifier() ?: element.getObjectKeyword()
)
}
is JetConstructorDelegationCall -> {
return SECONDARY_CONSTRUCTOR_DELEGATION_CALL.mark(element)
}
else -> {
return super.mark(element)
}
@@ -415,24 +418,12 @@ public object PositioningStrategies {
public val SECONDARY_CONSTRUCTOR_DELEGATION_CALL: PositioningStrategy<JetConstructorDelegationCall> =
object : PositioningStrategy<JetConstructorDelegationCall>() {
override fun mark(element: JetConstructorDelegationCall): List<TextRange> {
if (element.getCalleeExpression()?.isEmpty() ?: false) {
if (element.isImplicit()) {
val constructor = element.getStrictParentOfType<JetSecondaryConstructor>()!!
return markElement(constructor.getConstructorKeyword())
val valueParameterList = constructor.getValueParameterList() ?: return markElement(constructor)
return markRange(constructor.getConstructorKeyword(), valueParameterList.getLastChild())
}
return markElement(element.getCalleeExpression() ?: element)
}
}
public val SECONDARY_CONSTRUCTOR_DELEGATION_CALL_OR_DEFAULT: PositioningStrategy<PsiElement> =
object : PositioningStrategy<PsiElement>() {
override fun mark(element: PsiElement): List<TextRange> {
val parent = element.getParent()
if (parent is JetConstructorDelegationCall) {
return SECONDARY_CONSTRUCTOR_DELEGATION_CALL.mark(parent)
}
else {
return DEFAULT.mark(element)
}
}
}
}

View File

@@ -425,6 +425,8 @@ public class DefaultErrorMessages {
MAP.put(PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED, "Primary constructor call expected");
MAP.put(DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR, "Call to super is not allowed in enum constructor");
MAP.put(PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS, "Primary constructor required for data class");
MAP.put(EXPLICIT_DELEGATION_CALL_REQUIRED,
"Explicit 'this' or 'super' call is required. There is no constructor in superclass that can be called without arguments");
MAP.put(INIT_KEYWORD_BEFORE_CLASS_INITIALIZER_EXPECTED, "Expecting 'init' keyword before class initializer");

View File

@@ -23,3 +23,5 @@ import org.jetbrains.kotlin.renderer.DescriptorRendererImpl
public fun <P> renderParameter(parameter: P, renderer: Renderer<P>?): Any = renderer?.render(parameter) ?: parameter
public fun ClassDescriptor.renderKindWithName(): String = "${DescriptorRendererImpl.getClassKindPrefix(this)} '${getName()}'"
public fun ClassDescriptor.renderKind(): String = DescriptorRendererImpl.getClassKindPrefix(this)

View File

@@ -423,9 +423,13 @@ public class JetExpressionParsing extends AbstractJetParsing {
private void parsePostfixExpression() {
PsiBuilder.Marker expression = mark();
boolean firstExpressionParsed;
boolean doubleColonExpression = parseDoubleColonExpression();
if (!doubleColonExpression) {
parseAtomicExpression();
firstExpressionParsed = parseAtomicExpression();
}
else {
firstExpressionParsed = true;
}
while (true) {
@@ -439,19 +443,24 @@ public class JetExpressionParsing extends AbstractJetParsing {
else if (!doubleColonExpression && parseCallSuffix()) {
expression.done(CALL_EXPRESSION);
}
else if (at(DOT)) {
advance(); // DOT
else if (at(DOT) || at(SAFE_ACCESS)) {
IElementType expressionType = at(DOT) ? DOT_QUALIFIED_EXPRESSION : SAFE_ACCESS_EXPRESSION;
advance(); // DOT or SAFE_ACCESS
if (!firstExpressionParsed) {
expression.drop();
expression = mark();
}
parseCallExpression();
expression.done(DOT_QUALIFIED_EXPRESSION);
}
else if (at(SAFE_ACCESS)) {
advance(); // SAFE_ACCESS
parseCallExpression();
expression.done(SAFE_ACCESS_EXPRESSION);
if (firstExpressionParsed) {
expression.done(expressionType);
}
else {
firstExpressionParsed = true;
continue;
}
}
else if (atSet(Precedence.POSTFIX.getOperations())) {
parseOperationReference();
@@ -557,9 +566,11 @@ public class JetExpressionParsing extends AbstractJetParsing {
* : "package" // for the root package
* ;
*/
private void parseAtomicExpression() {
private boolean parseAtomicExpression() {
// System.out.println("atom at " + myBuilder.getTokenText());
boolean ok = true;
if (at(LPAR)) {
parseParenthesizedExpression();
}
@@ -625,9 +636,12 @@ public class JetExpressionParsing extends AbstractJetParsing {
parseStringTemplate();
}
else if (!parseLiteralConstant()) {
ok = false;
// TODO: better recovery if FIRST(element) did not match
errorWithRecovery("Expecting an element", EXPRESSION_FOLLOW);
}
return ok;
}
/*

View File

@@ -873,7 +873,7 @@ public class JetParsing extends AbstractJetParsing {
advance(); // CONSTRUCTOR_KEYWORD
TokenSet valueArgsRecoverySet = TokenSet.create(COLON, LBRACE, SEMICOLON, RPAR);
TokenSet valueArgsRecoverySet = TokenSet.create(COLON, LBRACE, SEMICOLON, RPAR, EOL_OR_SEMICOLON, RBRACE);
if (at(LPAR)) {
parseValueParameterList(false, /*typeRequired = */ true, valueArgsRecoverySet);
}
@@ -888,16 +888,26 @@ public class JetParsing extends AbstractJetParsing {
if (at(THIS_KEYWORD) || at(SUPER_KEYWORD)) {
parseThisOrSuper();
myExpressionParsing.parseValueArgumentList();
}
else {
// if we're on LPAR it's probably start of value arguments list
if (!at(LPAR)) {
advance(); // wrong delegation call keyword?
}
error("Expecting a 'this' or 'super' constructor call");
}
PsiBuilder.Marker beforeWrongDelegationCallee = null;
if (!at(LPAR)) {
beforeWrongDelegationCallee = mark();
advance(); // wrong delegation callee
}
myExpressionParsing.parseValueArgumentList();
myExpressionParsing.parseValueArgumentList();
if (beforeWrongDelegationCallee != null) {
if (at(LBRACE)) {
beforeWrongDelegationCallee.drop();
}
else {
beforeWrongDelegationCallee.rollbackTo();
}
}
}
delegationCall.done(CONSTRUCTOR_DELEGATION_CALL);
}
@@ -908,7 +918,9 @@ public class JetParsing extends AbstractJetParsing {
emptyDelegationCall.done(CONSTRUCTOR_DELEGATION_CALL);
}
parseBlock();
if (at(LBRACE)) {
parseBlock();
}
}
private void parseThisOrSuper() {

View File

@@ -64,4 +64,14 @@ public class JetConstructorDelegationCall extends JetElementImpl implements JetC
public JetConstructorDelegationReferenceExpression getCalleeExpression() {
return findChildByClass(JetConstructorDelegationReferenceExpression.class);
}
public boolean isImplicit() {
JetConstructorDelegationReferenceExpression callee = getCalleeExpression();
return callee != null && callee.getFirstChild() == null;
}
public boolean isCallToThis() {
JetConstructorDelegationReferenceExpression callee = getCalleeExpression();
return callee != null && callee.isThis();
}
}

View File

@@ -28,8 +28,4 @@ public class JetConstructorDelegationReferenceExpression extends JetExpressionIm
public boolean isThis() {
return findChildByType(JetTokens.THIS_KEYWORD) != null;
}
public boolean isEmpty() {
return getFirstChild() == null;
}
}

View File

@@ -22,9 +22,9 @@ import org.jetbrains.kotlin.JetNodeTypes
import org.jetbrains.kotlin.lexer.JetTokens
public abstract class JetDoubleColonExpression(node: ASTNode) : JetExpressionImpl(node) {
public fun getTypeReference(): JetTypeReference? = findChildByType(JetNodeTypes.TYPE_REFERENCE)
public fun getTypeReference(): JetTypeReference? = findChildByType(JetNodeTypes.TYPE_REFERENCE) as JetTypeReference?
public fun getDoubleColonTokenReference(): PsiElement = findChildByType(JetTokens.COLONCOLON)
public fun getDoubleColonTokenReference(): PsiElement = findChildByType(JetTokens.COLONCOLON)!!
override fun <R, D> accept(visitor: JetVisitor<R, D>, data: D): R {
return visitor.visitDoubleColonExpression(this, data)

View File

@@ -363,7 +363,7 @@ public class JetPsiFactory(private val project: Project) {
public fun createConstructorDelegationCall(text: String): JetConstructorDelegationCall {
val colonOrEmpty = if (text.isEmpty()) "" else ": "
return createClass("class A { constructor()$colonOrEmpty$text {}").getSecondaryConstructors().first().getDelegationCall()!!
return createClass("class A { constructor()$colonOrEmpty$text {}").getSecondaryConstructors().first().getDelegationCall()
}
public inner class IfChainBuilder() {

View File

@@ -88,7 +88,7 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
@Nullable
@Override
public JetExpression getBodyExpression() {
public JetBlockExpression getBodyExpression() {
return findChildByClass(JetBlockExpression.class);
}
@@ -105,7 +105,7 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
@Override
public boolean hasBody() {
return true;
return getBodyExpression() != null;
}
@Override
@@ -172,16 +172,36 @@ public class JetSecondaryConstructor extends JetDeclarationStub<KotlinPlaceHolde
throw new IncorrectOperationException("setName to constructor");
}
@Nullable
@NotNull
public JetConstructorDelegationCall getDelegationCall() {
return findChildByClass(JetConstructorDelegationCall.class);
}
public boolean hasImplicitDelegationCall() {
return getDelegationCall().isImplicit();
}
@NotNull
public JetClassOrObject getClassOrObject() {
return (JetClassOrObject) getParent().getParent();
}
@NotNull
public JetConstructorDelegationCall replaceImplicitDelegationCallWithExplicit(boolean isThis) {
JetPsiFactory psiFactory = new JetPsiFactory(getProject());
JetConstructorDelegationCall current = getDelegationCall();
assert current.isImplicit()
: "Method should not be called with explicit delegation call: " + getText();
current.delete();
PsiElement colon = addAfter(psiFactory.createColon(), getValueParameterList());
String delegationName = isThis ? "this" : "super";
return (JetConstructorDelegationCall) addAfter(psiFactory.createConstructorDelegationCall(delegationName + "()"), colon);
}
@NotNull
public PsiElement getConstructorKeyword() {
return findNotNullChildByType(JetTokens.CONSTRUCTOR_KEYWORD);

View File

@@ -24,4 +24,11 @@ public class JetTreeVisitor<D> extends JetVisitor<Void, D> {
element.acceptChildren(this, data);
return null;
}
@Override
public Void visitJetFile(@NotNull JetFile file, D data) {
super.visitJetFile(file, data);
file.acceptChildren(this, data);
return null;
}
}

View File

@@ -45,4 +45,8 @@ public class JetValueArgumentList extends JetElementImpl {
return findChildByType(JetTokens.RPAR);
}
@Nullable
public PsiElement getLeftParenthesis() {
return findChildByType(JetTokens.LPAR);
}
}

View File

@@ -18,17 +18,17 @@ package org.jetbrains.kotlin.resolve
import org.jetbrains.kotlin.resolve.calls.checkers.*
private val DEFAULT_ANNOTATION_CHECKERS = listOf(DataClassAnnotationChecker())
private val DEFAULT_DECLARATION_CHECKERS = listOf(DataClassAnnotationChecker())
private val DEFAULT_CALL_CHECKERS = listOf(CapturingInClosureChecker(), InlineCheckerWrapper(), ReifiedTypeParameterSubstitutionChecker())
private val DEFAULT_TYPE_CHECKERS = listOf(TypeApproximator())
public abstract class AdditionalCheckerProvider(
additionalAnnotationCheckers: List<AnnotationChecker>,
additionalDeclarationCheckers: List<DeclarationChecker>,
additionalCallCheckers: List<CallChecker>,
additionalTypeCheckers: List<AdditionalTypeChecker>
) {
public val annotationCheckers: List<AnnotationChecker> = DEFAULT_ANNOTATION_CHECKERS + additionalAnnotationCheckers
public val declarationCheckers: List<DeclarationChecker> = DEFAULT_DECLARATION_CHECKERS + additionalDeclarationCheckers
public val callCheckers: List<CallChecker> = DEFAULT_CALL_CHECKERS + additionalCallCheckers
public val additionalTypeCheckers: List<AdditionalTypeChecker> = DEFAULT_TYPE_CHECKERS + additionalTypeCheckers

View File

@@ -217,8 +217,9 @@ public class BodyResolver {
PsiElement constructorToReport = DescriptorToSourceUtils.descriptorToDeclaration(currentConstructor);
if (constructorToReport != null) {
JetConstructorDelegationCall call = ((JetSecondaryConstructor) constructorToReport).getDelegationCall();
assert call != null : "resolved call can't be null";
trace.report(CYCLIC_CONSTRUCTOR_DELEGATION_CALL.on(call));
assert call.getCalleeExpression() != null
: "Callee expression of delegation call should not be null on cycle as there should be explicit 'this' calls";
trace.report(CYCLIC_CONSTRUCTOR_DELEGATION_CALL.on(call.getCalleeExpression()));
}
currentConstructor = getDelegatedConstructor(currentConstructor);
@@ -229,7 +230,7 @@ public class BodyResolver {
@Nullable
private ConstructorDescriptor getDelegatedConstructor(@NotNull ConstructorDescriptor constructor) {
ResolvedCall<ConstructorDescriptor> call = trace.get(CONSTRUCTOR_RESOLVED_DELEGATION_CALL, constructor);
return call == null ? null : call.getResultingDescriptor().getOriginal();
return call == null || !call.getStatus().isSuccess() ? null : call.getResultingDescriptor().getOriginal();
}
public void resolveBodies(@NotNull BodiesResolveContext c) {

View File

@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.diagnostics.*
import org.jetbrains.kotlin.builtins.*
public class DataClassAnnotationChecker : AnnotationChecker {
public class DataClassAnnotationChecker : DeclarationChecker {
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
if (descriptor !is ClassDescriptor) return
if (declaration !is JetClassOrObject) return

View File

@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.psi.JetDeclaration
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
public trait AnnotationChecker {
public trait DeclarationChecker {
public fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink);

View File

@@ -105,6 +105,14 @@ public class DeclarationsChecker {
modifiersChecker.checkModifiersForDeclaration(property, propertyDescriptor);
}
for (Map.Entry<JetSecondaryConstructor, ConstructorDescriptor> entry : bodiesResolveContext.getSecondaryConstructors().entrySet()) {
ConstructorDescriptor constructorDescriptor = entry.getValue();
JetSecondaryConstructor declaration = entry.getKey();
modifiersChecker.reportIllegalModalityModifiers(declaration);
reportErrorIfHasIllegalModifier(declaration);
modifiersChecker.checkModifiersForDeclaration(declaration, constructorDescriptor);
}
}
private void reportErrorIfHasIllegalModifier(JetModifierListOwner declaration) {

View File

@@ -145,17 +145,24 @@ public class ModifiersChecker {
checkDefaultModifier(modifierListOwner);
checkModalityModifiers(modifierListOwner);
checkVisibilityModifiers(modifierListOwner, descriptor);
checkVarianceModifiersOfTypeParameters(modifierListOwner);
checkVarianceModifiers(modifierListOwner);
checkVarargsModifiers(modifierListOwner, descriptor);
}
checkPlatformNameApplicability(descriptor);
runAnnotationCheckers(modifierListOwner, descriptor);
runDeclarationCheckers(modifierListOwner, descriptor);
}
private void checkVarargsModifiers(@NotNull JetDeclaration owner, @NotNull MemberDescriptor descriptor) {
if (!(owner instanceof JetParameter)) {
reportIllegalModifiers(owner, Collections.singleton(VARARG_KEYWORD));
}
}
public void checkModifiersForLocalDeclaration(@NotNull JetDeclaration modifierListOwner, @NotNull DeclarationDescriptor descriptor) {
reportIllegalModalityModifiers(modifierListOwner);
reportIllegalVisibilityModifiers(modifierListOwner);
checkPlatformNameApplicability(descriptor);
runAnnotationCheckers(modifierListOwner, descriptor);
runDeclarationCheckers(modifierListOwner, descriptor);
}
public void reportIllegalModalityModifiers(@NotNull JetModifierListOwner modifierListOwner) {
@@ -288,7 +295,8 @@ public class ModifiersChecker {
JetAnnotationEntry annotationEntry = trace.get(BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT, annotation);
if (annotationEntry == null) return;
if (!DescriptorUtils.isTopLevelDeclaration(descriptor) || !(descriptor instanceof FunctionDescriptor)) {
if (!DescriptorUtils.isTopLevelDeclaration(descriptor) || !(descriptor instanceof FunctionDescriptor) ||
descriptor instanceof ConstructorDescriptor) {
trace.report(INAPPLICABLE_ANNOTATION.on(annotationEntry));
}
@@ -394,13 +402,14 @@ public class ModifiersChecker {
return Visibilities.INTERNAL;
}
private void runAnnotationCheckers(@NotNull JetDeclaration declaration, @NotNull DeclarationDescriptor descriptor) {
for (AnnotationChecker checker : additionalCheckerProvider.getAnnotationCheckers()) {
private void runDeclarationCheckers(@NotNull JetDeclaration declaration, @NotNull DeclarationDescriptor descriptor) {
for (DeclarationChecker checker : additionalCheckerProvider.getDeclarationCheckers()) {
checker.check(declaration, descriptor, trace);
}
}
public void checkVarianceModifiersOfTypeParameters(@NotNull JetModifierListOwner modifierListOwner) {
public void checkVarianceModifiers(@NotNull JetModifierListOwner modifierListOwner) {
reportIllegalModifiers(modifierListOwner, Arrays.asList(IN_KEYWORD, OUT_KEYWORD, REIFIED_KEYWORD));
if (!(modifierListOwner instanceof JetTypeParameterListOwner)) return;
List<JetTypeParameter> typeParameters = ((JetTypeParameterListOwner) modifierListOwner).getTypeParameters();
for (JetTypeParameter typeParameter : typeParameters) {

View File

@@ -188,7 +188,17 @@ public class CallResolver {
@NotNull Collection<ResolutionCandidate<D>> candidates,
@NotNull CallTransformer<D, F> callTransformer
) {
TracingStrategy tracing = TracingStrategyImpl.create(referenceExpression, context.call);
return computeTasksFromCandidatesAndResolvedCall(context, candidates, callTransformer,
TracingStrategyImpl.create(referenceExpression, context.call));
}
@NotNull
private <D extends CallableDescriptor, F extends D> OverloadResolutionResults<F> computeTasksFromCandidatesAndResolvedCall(
@NotNull BasicCallResolutionContext context,
@NotNull Collection<ResolutionCandidate<D>> candidates,
@NotNull CallTransformer<D, F> callTransformer,
@NotNull TracingStrategy tracing
) {
List<ResolutionTask<D, F>> prioritizedTasks =
taskPrioritizer.<D, F>computePrioritizedTasksFromCandidates(context, candidates, tracing);
return doResolveCallOrGetCachedResults(context, prioritizedTasks, callTransformer, tracing);
@@ -291,11 +301,10 @@ public class CallResolver {
public OverloadResolutionResults<FunctionDescriptor> resolveConstructorDelegationCall(
@NotNull BindingTrace trace, @NotNull JetScope scope, @NotNull DataFlowInfo dataFlowInfo,
@NotNull ConstructorDescriptor constructorDescriptor,
@Nullable JetConstructorDelegationCall call
@NotNull JetConstructorDelegationCall call
) {
// Returns `null` when there is nothing to resolve in trivial cases like `null` call expression or
// Method returns `null` when there is nothing to resolve in trivial cases like `null` call expression or
// when super call should be conventional enum constructor and super call should be empty
if (call == null) return null;
BasicCallResolutionContext context = BasicCallResolutionContext.create(
trace, scope,
@@ -306,13 +315,13 @@ public class CallResolver {
if (call.getCalleeExpression() == null) return checkArgumentTypesAndFail(context);
if (constructorDescriptor.getContainingDeclaration().getKind() == ClassKind.ENUM_CLASS &&
call.getCalleeExpression().isEmpty()) {
if (constructorDescriptor.getContainingDeclaration().getKind() == ClassKind.ENUM_CLASS && call.isImplicit()) {
return null;
}
return resolveConstructorDelegationCall(
context,
call,
call.getCalleeExpression(),
constructorDescriptor
);
@@ -321,6 +330,7 @@ public class CallResolver {
@NotNull
private OverloadResolutionResults<FunctionDescriptor> resolveConstructorDelegationCall(
@NotNull BasicCallResolutionContext context,
@NotNull JetConstructorDelegationCall call,
@NotNull JetConstructorDelegationReferenceExpression calleeExpression,
@NotNull ConstructorDescriptor calleeConstructor
) {
@@ -328,7 +338,7 @@ public class CallResolver {
boolean isThisCall = calleeExpression.isThis();
if (currentClassDescriptor.getKind() == ClassKind.ENUM_CLASS && !isThisCall) {
context.trace.report(DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR.on((JetConstructorDelegationCall) calleeExpression.getParent()));
context.trace.report(DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR.on(calleeExpression));
return checkArgumentTypesAndFail(context);
}
@@ -364,7 +374,11 @@ public class CallResolver {
knownTypeParametersSubstitutor));
}
return computeTasksFromCandidatesAndResolvedCall(context, calleeExpression, candidates, CallTransformer.FUNCTION_CALL_TRANSFORMER);
TracingStrategy tracing = call.isImplicit() ?
new TracingStrategyForImplicitConstructorDelegationCall(call, context.call) :
TracingStrategyImpl.create(calleeExpression, context.call);
return computeTasksFromCandidatesAndResolvedCall(context, candidates, CallTransformer.FUNCTION_CALL_TRANSFORMER, tracing);
}
public OverloadResolutionResults<FunctionDescriptor> resolveCallWithKnownCandidate(

View File

@@ -0,0 +1,145 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.resolve.calls.tasks
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.diagnostics.Errors.UNRESOLVED_REFERENCE
import org.jetbrains.kotlin.diagnostics.Errors.UNRESOLVED_REFERENCE_WRONG_RECEIVER
import org.jetbrains.kotlin.psi.Call
import org.jetbrains.kotlin.psi.JetConstructorDelegationCall
import org.jetbrains.kotlin.psi.JetFunctionLiteralArgument
import org.jetbrains.kotlin.psi.JetSecondaryConstructor
import org.jetbrains.kotlin.resolve.BindingContext.CALL
import org.jetbrains.kotlin.resolve.BindingContext.REFERENCE_TARGET
import org.jetbrains.kotlin.resolve.BindingContext.RESOLVED_CALL
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
import org.jetbrains.kotlin.types.ErrorUtils
import org.jetbrains.kotlin.types.JetType
public class TracingStrategyForImplicitConstructorDelegationCall(
val delegationCall: JetConstructorDelegationCall, call: Call
) : AbstractTracingStrategy(delegationCall.getCalleeExpression()!!, call) {
val calleeExpression = delegationCall.getCalleeExpression()
override fun bindCall(trace: BindingTrace, call: Call) {
trace.record(CALL, call.getCalleeExpression(), call)
}
override fun <D : CallableDescriptor> bindReference(trace: BindingTrace, resolvedCall: ResolvedCall<D>) {
val descriptor = resolvedCall.getCandidateDescriptor()
val storedReference = trace.get(REFERENCE_TARGET, calleeExpression)
if (storedReference == null || !ErrorUtils.isError(descriptor)) {
trace.record(REFERENCE_TARGET, calleeExpression, descriptor)
}
}
override fun <D : CallableDescriptor> bindResolvedCall(trace: BindingTrace, resolvedCall: ResolvedCall<D>) {
trace.record(RESOLVED_CALL, call, resolvedCall)
}
override fun unresolvedReference(trace: BindingTrace) {
trace.report(UNRESOLVED_REFERENCE.on(calleeExpression, calleeExpression))
}
override fun <D : CallableDescriptor> unresolvedReferenceWrongReceiver(trace: BindingTrace, candidates: Collection<ResolvedCall<D>>) {
trace.report(UNRESOLVED_REFERENCE_WRONG_RECEIVER.on(reference, candidates))
}
override fun noValueForParameter(trace: BindingTrace, valueParameter: ValueParameterDescriptor) {
reportError(trace)
}
override fun <D : CallableDescriptor?> ambiguity(trace: BindingTrace, descriptors: MutableCollection<out ResolvedCall<D>>) {
reportError(trace)
}
override fun <D : CallableDescriptor?> noneApplicable(trace: BindingTrace, descriptors: MutableCollection<out ResolvedCall<D>>) {
reportError(trace)
}
override fun invisibleMember(trace: BindingTrace, descriptor: DeclarationDescriptorWithVisibility) {
reportError(trace)
}
private fun reportError(trace: BindingTrace) {
trace.report(Errors.EXPLICIT_DELEGATION_CALL_REQUIRED.on(delegationCall))
}
// Underlying methods should not be called because such errors are impossible
// when resolving delegation call
override fun <D : CallableDescriptor?> cannotCompleteResolve(trace: BindingTrace, descriptors: MutableCollection<out ResolvedCall<D>>) {
unexpectedError("cannotCompleteResolve")
}
override fun instantiationOfAbstractClass(trace: BindingTrace) {
unexpectedError("instantiationOfAbstractClass")
}
override fun abstractSuperCall(trace: BindingTrace) {
unexpectedError("abstractSuperCall")
}
override fun nestedClassAccessViaInstanceReference(
trace: BindingTrace, classDescriptor: ClassDescriptor, explicitReceiverKind: ExplicitReceiverKind
) {
unexpectedError("nestedClassAccessViaInstanceReference")
}
override fun unsafeCall(trace: BindingTrace, type: JetType, isCallForImplicitInvoke: Boolean) {
unexpectedError("unsafeCall")
}
override fun unnecessarySafeCall(trace: BindingTrace, type: JetType) {
unexpectedError("unnecessarySafeCall")
}
override fun danglingFunctionLiteralArgumentSuspected(
trace: BindingTrace, functionLiteralArguments: MutableList<JetFunctionLiteralArgument>
) {
unexpectedError("danglingFunctionLiteralArgumentSuspected")
}
override fun missingReceiver(trace: BindingTrace, expectedReceiver: ReceiverParameterDescriptor) {
unexpectedError("missingReceiver")
}
override fun wrongReceiverType(trace: BindingTrace, receiverParameter: ReceiverParameterDescriptor, receiverArgument: ReceiverValue) {
unexpectedError("wrongReceiverType")
}
override fun noReceiverAllowed(trace: BindingTrace) {
unexpectedError("noReceiverAllowed")
}
override fun wrongNumberOfTypeArguments(trace: BindingTrace, expectedTypeArgumentCount: Int) {
unexpectedError("wrongNumberOfTypeArguments")
}
override fun typeInferenceFailed(trace: BindingTrace, data: InferenceErrorData) {
unexpectedError("typeInferenceFailed")
}
private fun unexpectedError(type: String) {
throw AssertionError("Unexpected error type: $type")
}
}

View File

@@ -23,14 +23,14 @@ import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics
import com.intellij.util.containers.ContainerUtil
import com.intellij.util.containers.ConcurrentSoftValueHashMap
public class LockBasedLazyResolveStorageManager(private val storageManager: StorageManager): StorageManager by storageManager, LazyResolveStorageManager {
override fun <K, V> createSoftlyRetainedMemoizedFunction(compute: Function1<K, V>) =
storageManager.createMemoizedFunction<K, V>(compute, ContainerUtil.createConcurrentSoftValueMap<K, Any>())
storageManager.createMemoizedFunction<K, V>(compute, ConcurrentSoftValueHashMap<K, Any>())
override fun <K, V> createSoftlyRetainedMemoizedFunctionWithNullableValues(compute: Function1<K, V>) =
storageManager.createMemoizedFunctionWithNullableValues<K, V>(compute, ContainerUtil.createConcurrentSoftValueMap<K, Any>())
storageManager.createMemoizedFunctionWithNullableValues<K, V>(compute, ConcurrentSoftValueHashMap<K, Any>())
// It seems safe to have a separate lock for traces:
// no other locks will be acquired inside the trace operations

View File

@@ -22,6 +22,8 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.isSubpackageOf
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.scopes.JetScope
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.TypeUtils.makeStarProjection
@@ -125,4 +127,12 @@ public class ReflectionTypes(private val module: ModuleDescriptor) {
arguments.add(TypeProjectionImpl(returnType))
return JetTypeImpl(annotations, classDescriptor.getTypeConstructor(), false, arguments, classDescriptor.getMemberScope(arguments))
}
companion object {
public fun isReflectionType(type: JetType): Boolean {
val descriptor = type.getConstructor().getDeclarationDescriptor() ?: return false
val fqName = DescriptorUtils.getFqName(descriptor)
return fqName.isSafe() && fqName.toSafe().isSubpackageOf(KOTLIN_REFLECT_FQ_NAME)
}
}
}

View File

@@ -212,7 +212,7 @@ public class JavaElementFinder extends PsiElementFinder implements KotlinFinderM
return answer.toArray(new PsiClass[answer.size()]);
}
@Override
// implements a method added in 14.1
@NotNull
public PsiFile[] getPackageFiles(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
FqName packageFQN = new FqName(psiPackage.getQualifiedName());
@@ -220,12 +220,13 @@ public class JavaElementFinder extends PsiElementFinder implements KotlinFinderM
return result.toArray(new PsiFile[result.size()]);
}
@Override
// implements a method added in IDEA 14.1
@SuppressWarnings({"UnusedDeclaration", "MethodMayBeStatic"})
@Nullable
public Condition<PsiFile> getPackageFilesFilter(@NotNull final PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
return new Condition<PsiFile>() {
@Override
public boolean value(PsiFile input) {
public boolean value(@Nullable PsiFile input) {
if (!(input instanceof JetFile)) {
return true;
}

View File

@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.asJava;
import com.intellij.lang.Language;
import com.intellij.psi.PsiAnnotationOwner;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiModifierList;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.search.GlobalSearchScope;
@@ -103,12 +102,6 @@ public class KotlinLightParameter extends LightParameter implements KotlinLightE
return setter != null ? setter.getParameter() : null;
}
@Override
public PsiFile getContainingFile() {
JetDeclaration declaration = method.getOrigin();
return declaration != null ? declaration.getContainingFile() : super.getContainingFile();
}
@NotNull
@Override
public Language getLanguage() {

View File

@@ -9,10 +9,3 @@ class Foo {
return [fancy] 1
}
}
fun test() {
class A {
fun foo(){}
}
}

View File

@@ -1,4 +1,3 @@
WARNING: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (8, 21) Parameter 'foo' is never used
ERROR: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (9, 16) Cannot translate (not supported yet): '[fancy] 1'
ERROR: compiler/testData/cli/js/diagnosticForUnhandledElements.kt: (15, 5) Cannot translate (not supported yet): 'class A {...'
COMPILATION_ERROR
COMPILATION_ERROR

View File

@@ -0,0 +1 @@
package android.appwidget

View File

@@ -0,0 +1 @@
package android.inputmethodservice

View File

@@ -0,0 +1 @@
package android.opengl

View File

@@ -0,0 +1 @@
package android.webkit

View File

@@ -9,4 +9,8 @@ plugin\:org.jetbrains.kotlin.android\:androidRes=$TESTDATA_DIR$/androidPlugin/re
$TESTDATA_DIR$/pluginSimple.kt
$TESTDATA_DIR$/androidPlugin/androidApp.kt
$TESTDATA_DIR$/androidPlugin/androidView.kt
$TESTDATA_DIR$/androidPlugin/androidWidget.kt
$TESTDATA_DIR$/androidPlugin/androidWidget.kt
$TESTDATA_DIR$/androidPlugin/fakeAppwidgetPackage.kt
$TESTDATA_DIR$/androidPlugin/fakeInputMethodServicePackage.kt
$TESTDATA_DIR$/androidPlugin/fakeOpenglPackage.kt
$TESTDATA_DIR$/androidPlugin/fakeWebkitPackage.kt

View File

@@ -7,4 +7,8 @@ plugin\:org.jetbrains.kotlin.android\:androidManifest=$TESTDATA_DIR$/androidPlug
$TESTDATA_DIR$/pluginSimple.kt
$TESTDATA_DIR$/androidPlugin/androidApp.kt
$TESTDATA_DIR$/androidPlugin/androidView.kt
$TESTDATA_DIR$/androidPlugin/androidWidget.kt
$TESTDATA_DIR$/androidPlugin/androidWidget.kt
$TESTDATA_DIR$/androidPlugin/fakeAppwidgetPackage.kt
$TESTDATA_DIR$/androidPlugin/fakeInputMethodServicePackage.kt
$TESTDATA_DIR$/androidPlugin/fakeOpenglPackage.kt
$TESTDATA_DIR$/androidPlugin/fakeWebkitPackage.kt

View File

@@ -11,7 +11,7 @@ class A(val result: Int) {
object C {
}
constructor() : this(foo() + prop + B.bar() + B.prop + C) {}
constructor() : this(foo() + prop + B.bar() + B.prop + C)
}
fun box(): String {

View File

@@ -1,13 +1,13 @@
open class A(val x: String = "abc", val y: String = "efg") {
constructor(x: String, y: String, z: Int): this(x, y + "#" + z.toString()) {}
constructor(x: String, y: String, z: Int): this(x, y + "#" + z.toString())
override fun toString() = "$x#$y"
}
class B : A {
constructor(x: String, y: String, z: Int): super(x, y + z.toString()) {}
constructor(x: String = "xyz", y: String = "123") : super(x, y) {}
constructor(x: Double): super(x.toString()) {}
constructor(x: String, y: String, z: Int): super(x, y + z.toString())
constructor(x: String = "xyz", y: String = "123") : super(x, y)
constructor(x: Double): super(x.toString())
}
fun box(): String {

View File

@@ -9,7 +9,7 @@ class B : A {
val global = B()
class C(x: Int) : A by global {
constructor(): this(1) {}
constructor(): this(1)
}
fun box(): String {

View File

@@ -1,11 +1,11 @@
open class B<T>(val x: T, val y: T) {
constructor(x: T): this(x, x) {}
constructor(x: T): this(x, x)
override fun toString() = "$x#$y"
}
class A : B<String> {
constructor(): super("default") {}
constructor(x: String): super(x, "default") {}
constructor(): super("default")
constructor(x: String): super(x, "default")
}
fun box(): String {

View File

@@ -0,0 +1,39 @@
import kotlin.reflect.KClass
import kotlin.test.assertEquals
fun check(klass: KClass<*>, expectedName: String) {
assertEquals(expectedName, klass.simpleName)
}
fun localInMethod() {
fun localInMethod(unused: Any?) {
class Local
check(Local::class, "Local")
class `Local$With$Dollars`
check(`Local$With$Dollars`::class, "Local\$With\$Dollars")
}
localInMethod(null)
class Local
check(Local::class, "Local")
class `Local$With$Dollars`
check(`Local$With$Dollars`::class, "Local\$With\$Dollars")
}
class LocalInConstructor {
init {
class Local
check(Local::class, "Local")
class `Local$With$Dollars`
check(`Local$With$Dollars`::class, "Local\$With\$Dollars")
}
}
fun box(): String {
localInMethod()
LocalInConstructor()
return "OK"
}

View File

@@ -0,0 +1,14 @@
import kotlin.reflect.jvm.kotlin
class A {
// There's a synthetic "$kotlinClass" field here
}
fun box(): String {
for (field in javaClass<A>().getDeclaredFields()) {
val prop = field.kotlin
if (prop != null) return "Fail, property found: $prop"
}
return "OK"
}

View File

@@ -30,7 +30,13 @@ annotation class annotated(val text: String = "not given")
class LegalModifier(val a: Int, annotated private var b: String, annotated vararg <!UNUSED_PARAMETER!>v<!>: Int)
//Check illegal modifier in constructor parameters
class IllegalModifiers1(<!ILLEGAL_MODIFIER!>private<!> <!UNUSED_PARAMETER!>a<!>: Int)
class IllegalModifiers1(
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>reified<!>
<!ILLEGAL_MODIFIER!>enum<!>
<!ILLEGAL_MODIFIER!>private<!>
<!UNUSED_PARAMETER!>a<!>: Int)
//Check multiple illegal modifiers in constructor
class IllegalModifiers2(<!ILLEGAL_MODIFIER!>private<!> <!ILLEGAL_MODIFIER!>abstract<!> <!UNUSED_PARAMETER!>a<!>: Int)
@@ -57,10 +63,10 @@ abstract class IllegalModifiers5() {
private fun qux() {
//Check illegal modifier in catch block
try {} catch (<!ILLEGAL_MODIFIER!>public<!> e: Exception) {}
try {} catch (<!ILLEGAL_MODIFIER!>in<!> <!ILLEGAL_MODIFIER!>out<!> <!ILLEGAL_MODIFIER!>reified<!> <!ILLEGAL_MODIFIER!>enum<!> <!ILLEGAL_MODIFIER!>public<!> e: Exception) {}
//Check multiple illegal modifiers in catch block
try {} catch (<!ILLEGAL_MODIFIER!>abstract<!> <!ILLEGAL_MODIFIER!>public<!> e: Exception) {}
try {} catch (<!ILLEGAL_MODIFIER!>in<!> <!ILLEGAL_MODIFIER!>out<!> <!ILLEGAL_MODIFIER!>reified<!> <!ILLEGAL_MODIFIER!>enum<!> <!ILLEGAL_MODIFIER!>abstract<!> <!ILLEGAL_MODIFIER!>public<!> e: Exception) {}
//Check annotations with illegal modifiers
try {} catch (annotated("a text") <!ILLEGAL_MODIFIER!>abstract<!> <!ILLEGAL_MODIFIER!>public<!> e: Exception) {}
@@ -80,4 +86,52 @@ abstract class IllegalModifiers6() {
<!ILLEGAL_MODIFIER!>public<!> annotated init {}
<!ILLEGAL_MODIFIER!>private<!> <!NOT_AN_ANNOTATION_CLASS!>IllegalModifiers6()<!> init {}
}
}
// strange inappropriate modifiers usages
<!ILLEGAL_MODIFIER!>override<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER!>vararg<!>
<!ILLEGAL_MODIFIER!>reified<!>
class IllegalModifiers7() {
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER!>inner<!>
<!ILLEGAL_ANNOTATION_KEYWORD!>annotation<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER!>vararg<!>
<!ILLEGAL_MODIFIER!>reified<!>
val x = 1
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER!>inner<!>
<!ILLEGAL_ANNOTATION_KEYWORD!>annotation<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER!>vararg<!>
<!ILLEGAL_MODIFIER!>reified<!>
fun foo() {}
}
// Secondary constructors
class IllegalModifiers8 {
<!ILLEGAL_MODIFIER, INCOMPATIBLE_MODIFIERS!>abstract<!>
<!ILLEGAL_ENUM_ANNOTATION!>enum<!>
<!ILLEGAL_MODIFIER, REDUNDANT_MODIFIER, REDUNDANT_MODIFIER, INCOMPATIBLE_MODIFIERS!>open<!>
<!ILLEGAL_MODIFIER!>inner<!>
<!ILLEGAL_ANNOTATION_KEYWORD!>annotation<!>
<!ILLEGAL_MODIFIER!>override<!>
<!ILLEGAL_MODIFIER!>out<!>
<!ILLEGAL_MODIFIER!>in<!>
<!ILLEGAL_MODIFIER, INCOMPATIBLE_MODIFIERS!>final<!>
<!ILLEGAL_MODIFIER!>vararg<!>
<!ILLEGAL_MODIFIER!>reified<!>
constructor() {}
constructor(<!ILLEGAL_MODIFIER!>private<!> <!ILLEGAL_MODIFIER!>enum<!> <!ILLEGAL_MODIFIER!>abstract<!> <!UNUSED_PARAMETER!>x<!>: Int) {}
}
class IllegalModifiers9 {
<!INCOMPATIBLE_MODIFIERS!>private<!> <!INCOMPATIBLE_MODIFIERS!>protected<!> constructor() {}
<!INCOMPATIBLE_MODIFIERS!>private<!> <!INCOMPATIBLE_MODIFIERS!>internal<!> constructor(<!UNUSED_PARAMETER!>x<!>: Int) {}
}

View File

@@ -84,6 +84,31 @@ package illegal_modifiers {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal open class IllegalModifiers7 {
public constructor IllegalModifiers7()
internal final val x: kotlin.Int = 1
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class IllegalModifiers8 {
public constructor IllegalModifiers8()
public constructor IllegalModifiers8(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class IllegalModifiers9 {
private constructor IllegalModifiers9()
private constructor IllegalModifiers9(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class LegalModifier {
public constructor LegalModifier(/*0*/ a: kotlin.Int, /*1*/ illegal_modifiers.annotated() b: kotlin.String, /*2*/ illegal_modifiers.annotated() vararg v: kotlin.Int /*kotlin.IntArray*/)
internal final val a: kotlin.Int

View File

@@ -1,4 +1,4 @@
class A {
constructor() {}
constructor()
init {}
}

View File

@@ -12,6 +12,6 @@ class A {
object C {
}
constructor(x: Int) {}
constructor() : this(foo() + prop + B.bar() + B.prop + C) {}
constructor(x: Int)
constructor() : this(foo() + prop + B.bar() + B.prop + C)
}

View File

@@ -1,15 +1,15 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(x: Int) {
constructor(x: Double): this(1) {}
constructor(x: String): this(1) {}
constructor(x: Double): this(1)
constructor(x: String): this(1)
}
val x1: A = A(1)
val x2: A = A(1.0)
val x3: A = A("abc")
class B<R> {
constructor(x: String) {}
constructor(x: R) {}
constructor(x: String)
constructor(x: R)
}
val y1: B<Int> = B(1)

View File

@@ -1,20 +1,20 @@
object A {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
init {}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>init {}
}
enum class B {
X : B() {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>}
}
class C {
companion object {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>}
}
val anonObject = object {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>}

View File

@@ -1,3 +1,3 @@
trait A {
<!CONSTRUCTOR_IN_TRAIT!>constructor() {}<!>
}
<!CONSTRUCTOR_IN_TRAIT!>constructor()
<!>}

View File

@@ -3,7 +3,7 @@ annotation class Ann1
annotation class Ann2(val x: Int)
class A {
Ann1 constructor() {}
<!NO_VALUE_FOR_PARAMETER!>Ann2<!> constructor(x1: Int) {}
Ann2(2) constructor(x1: Int, x2: Int) {}
Ann1 constructor()
<!NO_VALUE_FOR_PARAMETER!>Ann2<!> constructor(x1: Int)
Ann2(2) constructor(x1: Int, x2: Int)
}

View File

@@ -1,39 +1,39 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A1 {
constructor(): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>() {}
constructor(): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>()
}
class A2(x: Byte) {
constructor(x1: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1) {}
constructor(x1: Int, x2: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2) {}
constructor(x1: Int, x2: Int, x3: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1) {}
constructor(x1: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1)
constructor(x1: Int, x2: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2)
constructor(x1: Int, x2: Int, x3: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1)
// delegating to previously declared cycle
constructor(x1: Double): this(1) {}
constructor(x1: Double): this(1)
// delegating to cycle declared after
constructor(x1: String): this(1L) {}
constructor(x1: String): this(1L)
constructor(x1: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1L) {}
constructor(x1: Long, x2: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2L) {}
constructor(x1: Long, x2: Long, x3: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1) {}
constructor(x1: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1L)
constructor(x1: Long, x2: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2L)
constructor(x1: Long, x2: Long, x3: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1)
// no cycle, just call to primary constuctor
constructor(x1: Double, x2: Double): this(x1, x2, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double, x4: Double): this(1.toByte()) {}
constructor(x1: Double, x2: Double): this(x1, x2, 1.0)
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0)
constructor(x1: Double, x2: Double, x3: Double, x4: Double): this(1.toByte())
constructor(): this("x", "y") {}
constructor(): this("x", "y")
constructor(x1: String, x2: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, "") {}
constructor(x1: String, x2: String, x3: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2) {}
constructor(x1: String, x2: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, "")
constructor(x1: String, x2: String, x3: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2)
}
open class B(x: Byte)
class A : B {
// no cycle, just call to super constuctor
constructor(x1: Double, x2: Double): this(x1, x2, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double, x4: Double): super(1.toByte()) {}
constructor(x1: Double, x2: Double): this(x1, x2, 1.0)
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0)
constructor(x1: Double, x2: Double, x3: Double, x4: Double): super(1.toByte())
}

View File

@@ -1,12 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
data class A1(val x: String) {
constructor(): this("") {}
constructor(): this("")
}
data class A2() {
constructor(x: String): this() {}
constructor(x: String): this()
}
data class <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>A3<!> {
constructor() {}
constructor()
}

View File

@@ -1,6 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(x: Any, y: Any, z: Any) {}
constructor(x: Any, y: Any, z: Any)
constructor(x: String?, y: String?): this(x!!, <!DEBUG_INFO_SMARTCAST!>x<!>.length().toString() + y!!, "") {
<!DEBUG_INFO_SMARTCAST!>x<!>.length() + <!DEBUG_INFO_SMARTCAST!>y<!>.length()
}

View File

@@ -2,5 +2,5 @@ trait A
class AImpl : A
class B : <!UNSUPPORTED!>A by AImpl()<!> {
constructor() {}
constructor()
}

View File

@@ -2,24 +2,24 @@
enum class A {
W: A(1) X: A(1, 2) Y: A(3.0) Z: A("") E: A()
constructor() {}
constructor(x: Int) {}
constructor(x: Int, y: Int): this(x+y) {}
constructor(x: Double): this(x.toInt(), 1) {}
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1) {}
constructor()
constructor(x: Int)
constructor(x: Int, y: Int): this(x+y)
constructor(x: Double): this(x.toInt(), 1)
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1)
}
enum class B(x: Int) {
W: B(1) X: B(1, 2) Y: B(3.0) Z: B("")
constructor(x: Int, y: Int): this(x+y) {}
constructor(x: Double): this(x.toInt(), 1) {}
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1) {}
constructor(x: Int, y: Int): this(x+y)
constructor(x: Double): this(x.toInt(), 1)
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1)
}
enum class C {
EMPTY: C() // may be we should avoid explicit call here
constructor() {}
constructor()
}
enum class D(val prop: Int) {
@@ -33,8 +33,8 @@ enum class D(val prop: Int) {
override fun f() = prop
}
constructor(): this(1) {}
constructor(x: String): this(x.length()) {}
constructor(): this(1)
constructor(x: String): this(x.length())
abstract fun f(): Int
}

View File

@@ -0,0 +1,42 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B0(x: Int)
class A0 : B0 {
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
constructor(x: Int) : super(<!NO_VALUE_FOR_PARAMETER!>)<!>
}
// --------------------------
open class B1 {
constructor(x: Int = 1)
constructor()
}
class A1 : B1 {
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
constructor(x: Int) : <!OVERLOAD_RESOLUTION_AMBIGUITY!>super<!>()
}
// --------------------------
open class B2 {
constructor(x: Int)
constructor(x: String)
}
class A2 : B2 {
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
constructor(x: Int) : <!NONE_APPLICABLE!>super<!>()
}
// --------------------------
open class B3 {
private constructor()
}
class A3 : B3 {
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor()<!>
constructor(x: Int) : <!INVISIBLE_MEMBER!>super<!>()
}

View File

@@ -0,0 +1,63 @@
package
internal final class A0 : B0 {
public constructor A0()
public constructor A0(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class A1 : B1 {
public constructor A1()
public constructor A1(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class A2 : B2 {
public constructor A2()
public constructor A2(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class A3 : B3 {
public constructor A3()
public constructor A3(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal open class B0 {
public constructor B0(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal open class B1 {
public constructor B1()
public constructor B1(/*0*/ x: kotlin.Int = ...)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal open class B2 {
public constructor B2(/*0*/ x: kotlin.Int)
public constructor B2(/*0*/ x: kotlin.String)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal open class B3 {
private constructor B3()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}

View File

@@ -1,8 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(x: Int) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor<!>() {}
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor()<!>
}
open class B(x: Int)
class C(x: Int) : B(x) {
constructor(): <!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>super<!>(1) {}
constructor(): <!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>super<!>(1)
}

View File

@@ -1,21 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE
open class B<T>(x: T, y: T) {
constructor(x: T): this(x, x) {}
constructor(): this(null!!, null!!) {}
constructor(x: T): this(x, x)
constructor(): this(null!!, null!!)
}
class A0 : B<String?> {
constructor() {}
constructor(x: String): super(x) {}
constructor(x: String, y: String): super(x, y) {}
constructor()
constructor(x: String): super(x)
constructor(x: String, y: String): super(x, y)
}
class A1<R> : B<R> {
constructor() {}
constructor(x: R): super(x) {}
constructor(x: R, y: R): super(x, y) {}
constructor()
constructor(x: R): super(x)
constructor(x: R, y: R): super(x, y)
}
class A2<R> {
constructor(t: R, i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1) {}
constructor(t: R, i: Int) : this(<!TYPE_MISMATCH!>i<!>, 1)
}

View File

@@ -2,25 +2,25 @@
open class B<R1, R2>(x: R1, y: R2)
class A0<T1, T2> {
constructor(x: T1, y: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, y) {}
constructor(x: T1, y: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, y)
constructor(x: T1, y: T2, z: T2): this(x, 1) {} // ok, delegates to constructor(x: T1, y: Int)
constructor(x: T1, y: T2, z: T2): this(x, 1) // ok, delegates to constructor(x: T1, y: Int)
constructor(x: T1, y: Int): <!NONE_APPLICABLE!>this<!>(x, "") {}
constructor(x: T1): this(x, 1) {}
constructor(x: T1, y: T2, z: String): <!NONE_APPLICABLE!>this<!>(y, x) {}
constructor(x: T1, y: Int): <!NONE_APPLICABLE!>this<!>(x, "")
constructor(x: T1): this(x, 1)
constructor(x: T1, y: T2, z: String): <!NONE_APPLICABLE!>this<!>(y, x)
}
class A1<T1, T2> : B<T1, T2> {
constructor(x: T1, y: T2): super(x, y) {}
constructor(x: T1, y: Int): super(x, <!TYPE_MISMATCH(T2; kotlin.Int)!>y<!>) {}
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(T2; T1)!>y<!>) {}
constructor(x: T1, y: T2): super(x, y)
constructor(x: T1, y: Int): super(x, <!TYPE_MISMATCH(T2; kotlin.Int)!>y<!>)
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(T2; T1)!>y<!>)
}
class A2<T1, T2> : B<T1, Int> {
constructor(x: T1, y: T2): super(x, <!TYPE_MISMATCH(kotlin.Int; T2)!>y<!>) {}
constructor(x: T1, y: Int): super(x, y) {}
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(kotlin.Int; T1)!>y<!>) {}
constructor(x: T1, y: T2, z: String): super(<!TYPE_MISMATCH(T1; T2)!>y<!>, 1) {}
constructor(x: T1, y: T2): super(x, <!TYPE_MISMATCH(kotlin.Int; T2)!>y<!>)
constructor(x: T1, y: Int): super(x, y)
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(kotlin.Int; T1)!>y<!>)
constructor(x: T1, y: T2, z: String): super(<!TYPE_MISMATCH(T1; T2)!>y<!>, 1)
}

View File

@@ -1,16 +1,16 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B<X, Y : X> {
constructor(x: X, y: Y) {}
constructor(x: X, s: String) {}
constructor(y: Y, i: Int) : this(y, "") {}
constructor(x: X, y: Y)
constructor(x: X, s: String)
constructor(y: Y, i: Int) : this(y, "")
}
class A<T1, T2 : T1> : B<T1, T2> {
constructor(x: T1, y: T2): super(x, y) {}
constructor(x: T2, y: T2, z: String): super(x, y) {}
constructor(x: T1, y: T2): super(x, y)
constructor(x: T2, y: T2, z: String): super(x, y)
constructor(x: T2, z: String, z1: String): super(x, "") {}
constructor(x: T2, z: String, z1: String, z2: String): super(x, 1) {}
constructor(x: T1, z: String, z1: String, z2: String, z3: String): super(x, "") {}
constructor(x: T1, z: String, z1: String, z2: String, z3: String, z4: String): <!NONE_APPLICABLE!>super<!>(x, 1) {}
constructor(x: T2, z: String, z1: String): super(x, "")
constructor(x: T2, z: String, z1: String, z2: String): super(x, 1)
constructor(x: T1, z: String, z1: String, z2: String, z3: String): super(x, "")
constructor(x: T1, z: String, z1: String, z2: String, z3: String, z4: String): <!NONE_APPLICABLE!>super<!>(x, 1)
}

View File

@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(x: Int)
class A : <!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>B(1)<!> {
constructor(): super(1) {}
constructor(): super(1)
}

View File

@@ -11,5 +11,5 @@ class A {
}
}
class A1(val x: Int, val y: Int) {
constructor(other: A1): this(other.x, other.y) {}
constructor(other: A1): this(other.x, other.y)
}

View File

@@ -1,3 +1,3 @@
class X<T>(val t: T) {
constructor(t: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(t) {}
constructor(t: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(t)
}

View File

@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class X<T>(val t: T) {
constructor(t: T, i: Int) : <!NONE_APPLICABLE!>this<!>(i) {
}
constructor(t: T, i: Int) : <!NONE_APPLICABLE!>this<!>(i)
}

View File

@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class X<T> {
constructor(t: T, i: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1) { // no error
}
constructor(t: T, i: Int): this(<!TYPE_MISMATCH!>i<!>, 1)
}

View File

@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A<T1, T2> {
constructor(block: (T1) -> T2) {}
constructor(x: T2): this({ x }) {}
constructor(block: (T1) -> T2)
constructor(x: T2): this({ x })
}

View File

@@ -3,11 +3,11 @@ open class B(open val parentProperty: String)
class A : B {
val myProp: String = ""
override val parentProperty: String = ""
constructor(arg: String = <!UNRESOLVED_REFERENCE!>myProp<!>): super(<!UNRESOLVED_REFERENCE!>myProp<!>) {}
constructor(x1: String, arg: String = <!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>): super(<!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>) {}
constructor(x1: String, x2: String, arg: String = <!UNRESOLVED_REFERENCE!>parentProperty<!>): super(<!UNRESOLVED_REFERENCE!>parentProperty<!>) {}
constructor(x1: String, x2: String, x3: String, arg: String = <!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>): super(<!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>) {}
constructor(x1: String, x2: String, x3: String, x4: String, arg: String = foo(<!NO_THIS!>this<!>)): super(foo(<!NO_THIS!>this<!>)) {}
constructor(x1: String, x2: String, x3: String, x4: String, x5: String, arg: String = foo(this<!UNRESOLVED_REFERENCE!>@A<!>)): super(foo(this<!UNRESOLVED_REFERENCE!>@A<!>)) {}
constructor(arg: String = <!UNRESOLVED_REFERENCE!>myProp<!>): super(<!UNRESOLVED_REFERENCE!>myProp<!>)
constructor(x1: String, arg: String = <!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>): super(<!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>)
constructor(x1: String, x2: String, arg: String = <!UNRESOLVED_REFERENCE!>parentProperty<!>): super(<!UNRESOLVED_REFERENCE!>parentProperty<!>)
constructor(x1: String, x2: String, x3: String, arg: String = <!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>): super(<!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>)
constructor(x1: String, x2: String, x3: String, x4: String, arg: String = foo(<!NO_THIS!>this<!>)): super(foo(<!NO_THIS!>this<!>))
constructor(x1: String, x2: String, x3: String, x4: String, x5: String, arg: String = foo(this<!UNRESOLVED_REFERENCE!>@A<!>)): super(foo(this<!UNRESOLVED_REFERENCE!>@A<!>))
}
fun foo(x: A) = ""

View File

@@ -0,0 +1,7 @@
class A {
open inner class Inner
class Nested : Inner {
<!INACCESSIBLE_OUTER_CLASS_EXPRESSION!>constructor()<!>
}
}

View File

@@ -0,0 +1,22 @@
package
internal final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal open inner class Inner {
public constructor Inner()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class Nested : A.Inner {
public constructor Nested()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}

View File

@@ -1,4 +1,4 @@
// do not report generate empty synthetic constructor by primary as it leads to CONFLICTING_JVM_DECLARATIONS
class A(val x: Int = 1, val y: Int = 2) {
constructor(): this(0, 0) {}
constructor(): this(0, 0)
}

View File

@@ -1,8 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(x: Int) {
}
constructor(x: Int)
}
val x = A(<!NO_VALUE_FOR_PARAMETER!>)<!>

View File

@@ -2,5 +2,5 @@ open class B
trait C
trait D
class A : C, B, D {
constructor() {}
constructor()
}

View File

@@ -1,27 +1,26 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class <!CONFLICTING_OVERLOADS!>A(x: String = "", y: String = "")<!> {
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y) {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y)
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
}
class B {
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!> {}
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!>
}
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
class Outer {
class <!CONFLICTING_OVERLOADS!>A(x: String = "", y: String = "")<!> {
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y) {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y)
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
}
class B {
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!> {
}
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!>
}
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}

View File

@@ -1,11 +1,11 @@
class <!REDECLARATION!>A<!>
class <!REDECLARATION!>A<!> {
constructor() {}
constructor()
}
class B
class Outer {
class B {
constructor() {}
constructor()
}
}

View File

@@ -1,4 +1,4 @@
class A {
val prop: Int = <!TYPE_MISMATCH!>""<!>
constructor() {}
constructor()
}

View File

@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(): super(<!TOO_MANY_ARGUMENTS!>1<!>) { }
constructor(): super(<!TOO_MANY_ARGUMENTS!>1<!>)
}

View File

@@ -1,10 +1,10 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(x: Double) {
constructor(x: Int): this(1.0) {}
constructor(x: String): this(1.0) {}
constructor(x: Int): this(1.0)
constructor(x: String): this(1.0)
}
trait C
class A : B, C {
constructor(): <!NONE_APPLICABLE!>super<!>(' ') { }
<!NONE_APPLICABLE!>constructor<!>(x: Int) { }
constructor(): <!NONE_APPLICABLE!>super<!>(' ')
<!EXPLICIT_DELEGATION_CALL_REQUIRED!>constructor(x: Int)<!>
}

View File

@@ -3,5 +3,5 @@ class A {
constructor(
<!VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER!>val<!> x: Int, y: Int,
<!VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER!>var<!> z: Int,
<!ILLEGAL_MODIFIER!>public<!> a: Int) {}
<!ILLEGAL_MODIFIER!>public<!> a: Int)
}

View File

@@ -2,11 +2,11 @@
fun <T> array(vararg x: T): Array<T> = null!!
open class B(vararg y: String) {
constructor(x: Int): this(x.toString(), *array("1"), "2") {}
constructor(x: Int): this(x.toString(), *array("1"), "2")
}
class A : B {
constructor(x: String, y: String): super(x, *array("3"), y) {}
constructor(x: String): super(x) {}
constructor(): super() {}
constructor(x: String, y: String): super(x, *array("3"), y)
constructor(x: String): super(x)
constructor(): super()
}

View File

@@ -2,13 +2,13 @@
fun <T> array(vararg x: T): Array<T> = null!!
open class B(x: Int) {
constructor(vararg y: String): this(y[0].length()) {}
constructor(vararg y: String): this(y[0].length())
}
class A : B {
constructor(x: String, y: String): super(x, *array("q"), y) {}
constructor(x: String): super(x) {}
constructor(): super() {}
constructor(x: String, y: String): super(x, *array("q"), y)
constructor(x: String): super(x)
constructor(): super()
}
val b1 = B()

View File

@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -NON_TOPLEVEL_CLASS_DECLARATION
// !MARK_DYNAMIC_CALLS
fun test(d: dynamic) {
@@ -97,4 +98,4 @@ fun test(d: dynamic) {
val dyn: dynamic = null
val foo : Int <!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>by dyn<!>
var bar : Int <!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>by dyn<!>
var bar : Int <!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>by dyn<!>

View File

@@ -1,7 +1,9 @@
// !DIAGNOSTICS: -NON_TOPLEVEL_CLASS_DECLARATION
val foo: dynamic = 1
fun foo() {
class C {
val foo: dynamic = 1
}
}
}

View File

@@ -0,0 +1,16 @@
fun test() {
js(<!JSCODE_NO_JAVASCRIPT_PRODUCED!>""<!>)
js(<!JSCODE_NO_JAVASCRIPT_PRODUCED!>" "<!>)
js(<!JSCODE_NO_JAVASCRIPT_PRODUCED!>"""
"""<!>)
val empty = ""
js(<!JSCODE_NO_JAVASCRIPT_PRODUCED!>empty<!>)
val whitespace = " "
js(<!JSCODE_NO_JAVASCRIPT_PRODUCED!>whitespace<!>)
val multiline = """
"""
js(<!JSCODE_NO_JAVASCRIPT_PRODUCED!>multiline<!>)
}

View File

@@ -0,0 +1,3 @@
package
internal fun test(): kotlin.Unit

View File

@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION
fun foo() {
class A {
@@ -42,4 +42,4 @@ fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>nativeGetter
fun baz(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Int = 0<!>): Int?<!> = 0
}
}
}

View File

@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION
fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>[nativeGetter]

View File

@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION
class A {
class B {
@@ -109,4 +109,4 @@ class A {
fun baz(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: String = "foo"<!>): Int?<!> = 0
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More