mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-22 15:51:33 +00:00
Compare commits
92 Commits
rr/mitropo
...
v1.2-rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fcbb4307f | ||
|
|
22de8cac5e | ||
|
|
ed7b563cb7 | ||
|
|
32c555fbe3 | ||
|
|
e1f3b4c2de | ||
|
|
cf445ab977 | ||
|
|
22604abfc7 | ||
|
|
c394037339 | ||
|
|
55209fd60f | ||
|
|
32de211e88 | ||
|
|
7c3d079eeb | ||
|
|
afd83dc86e | ||
|
|
79925cfe2f | ||
|
|
99ab812cee | ||
|
|
1506a72fc3 | ||
|
|
66bc20ccf9 | ||
|
|
292800c295 | ||
|
|
fa18ac4690 | ||
|
|
4e01178e7b | ||
|
|
7b0f1eadd3 | ||
|
|
65d4ea40f4 | ||
|
|
7af997424f | ||
|
|
881316d2af | ||
|
|
2181290c64 | ||
|
|
6f82d464c1 | ||
|
|
c6d232a16e | ||
|
|
edca38584e | ||
|
|
73cf115bd7 | ||
|
|
e308dd02d8 | ||
|
|
2058b5d750 | ||
|
|
a284f9d28b | ||
|
|
85e3cded24 | ||
|
|
d6d785c2bf | ||
|
|
8c751b402f | ||
|
|
7124c690c6 | ||
|
|
7dcb68bccd | ||
|
|
059133ea06 | ||
|
|
766ba407fd | ||
|
|
200fd2852e | ||
|
|
3000ee65b4 | ||
|
|
f9a8113d1b | ||
|
|
c40572548f | ||
|
|
1142cb1486 | ||
|
|
9a1681087f | ||
|
|
09ead0edad | ||
|
|
97616416dc | ||
|
|
55e8e84063 | ||
|
|
216bdcbd41 | ||
|
|
f2628d4f70 | ||
|
|
97399b99ee | ||
|
|
71867c4b73 | ||
|
|
f9449308d7 | ||
|
|
478611eb52 | ||
|
|
64e1c88ac1 | ||
|
|
06cb9127f4 | ||
|
|
0d80bcc8cf | ||
|
|
db0d95eea8 | ||
|
|
fd839dcb05 | ||
|
|
81f53bb1e5 | ||
|
|
88f061c152 | ||
|
|
8a3a4df93a | ||
|
|
2f1d4c15c9 | ||
|
|
4c3b9d58fb | ||
|
|
46b005bafc | ||
|
|
5d4d444f97 | ||
|
|
7a5051128a | ||
|
|
fa2d276718 | ||
|
|
7b873eb8ce | ||
|
|
979c7c06ef | ||
|
|
6e0e4a634e | ||
|
|
c7bc8b280c | ||
|
|
d363f5be7e | ||
|
|
e8b944ebbf | ||
|
|
ead2cb374a | ||
|
|
ba040ebd61 | ||
|
|
f3921a3d24 | ||
|
|
2d50bef4f7 | ||
|
|
323ec39ac6 | ||
|
|
acb2850260 | ||
|
|
0da4bf4c08 | ||
|
|
765fe92165 | ||
|
|
ed4f3d3bf6 | ||
|
|
7e49e17ce5 | ||
|
|
5052ae5cf8 | ||
|
|
24e218afc8 | ||
|
|
ab6360a7d5 | ||
|
|
058b832b71 | ||
|
|
b460b89df5 | ||
|
|
c7253584c5 | ||
|
|
c4e4298eac | ||
|
|
e4b4475235 | ||
|
|
7cddd345f8 |
3846
ChangeLog.md
3846
ChangeLog.md
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.config.shouldWritePreReleaseFlag
|
||||
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
|
||||
|
||||
@@ -58,18 +59,23 @@ data class JvmBuildMetaInfo(
|
||||
}
|
||||
}
|
||||
|
||||
fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo =
|
||||
JvmBuildMetaInfo(isEAP = KotlinCompilerVersion.isPreRelease(),
|
||||
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
||||
languageVersionString = args.languageVersion ?: LanguageVersion.LATEST_STABLE.versionString,
|
||||
apiVersionString = args.apiVersion ?: ApiVersion.LATEST_STABLE.versionString,
|
||||
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
|
||||
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
|
||||
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
|
||||
multiplatformEnable = args.multiPlatform,
|
||||
metadataVersionMajor = JvmMetadataVersion.INSTANCE.major,
|
||||
metadataVersionMinor = JvmMetadataVersion.INSTANCE.minor,
|
||||
metadataVersionPatch = JvmMetadataVersion.INSTANCE.patch,
|
||||
bytecodeVersionMajor = JvmBytecodeBinaryVersion.INSTANCE.major,
|
||||
bytecodeVersionMinor = JvmBytecodeBinaryVersion.INSTANCE.minor,
|
||||
bytecodeVersionPatch = JvmBytecodeBinaryVersion.INSTANCE.patch)
|
||||
fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo {
|
||||
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
|
||||
|
||||
return JvmBuildMetaInfo(
|
||||
isEAP = languageVersion.shouldWritePreReleaseFlag(),
|
||||
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
||||
languageVersionString = languageVersion.versionString,
|
||||
apiVersionString = args.apiVersion ?: ApiVersion.LATEST_STABLE.versionString,
|
||||
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
|
||||
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
|
||||
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
|
||||
multiplatformEnable = args.multiPlatform,
|
||||
metadataVersionMajor = JvmMetadataVersion.INSTANCE.major,
|
||||
metadataVersionMinor = JvmMetadataVersion.INSTANCE.minor,
|
||||
metadataVersionPatch = JvmMetadataVersion.INSTANCE.patch,
|
||||
bytecodeVersionMajor = JvmBytecodeBinaryVersion.INSTANCE.major,
|
||||
bytecodeVersionMinor = JvmBytecodeBinaryVersion.INSTANCE.minor,
|
||||
bytecodeVersionPatch = JvmBytecodeBinaryVersion.INSTANCE.patch
|
||||
)
|
||||
}
|
||||
|
||||
@@ -44837,6 +44837,19 @@ public final class DebugJsAstProtoBuf {
|
||||
*/
|
||||
int getSuperNameId();
|
||||
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
java.util.List<java.lang.Integer> getInterfaceNameIdList();
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
int getInterfaceNameIdCount();
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
int getInterfaceNameId(int index);
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock post_declaration_block = 3;</code>
|
||||
*/
|
||||
@@ -44925,6 +44938,27 @@ public final class DebugJsAstProtoBuf {
|
||||
bitField0_ |= 0x00000004;
|
||||
break;
|
||||
}
|
||||
case 32: {
|
||||
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
interfaceNameId_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00000004;
|
||||
}
|
||||
interfaceNameId_.add(input.readInt32());
|
||||
break;
|
||||
}
|
||||
case 34: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) {
|
||||
interfaceNameId_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00000004;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
interfaceNameId_.add(input.readInt32());
|
||||
}
|
||||
input.popLimit(limit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -44933,6 +44967,9 @@ public final class DebugJsAstProtoBuf {
|
||||
throw new org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException(
|
||||
e.getMessage()).setUnfinishedMessage(this);
|
||||
} finally {
|
||||
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
interfaceNameId_ = java.util.Collections.unmodifiableList(interfaceNameId_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
makeExtensionsImmutable();
|
||||
}
|
||||
@@ -44995,6 +45032,28 @@ public final class DebugJsAstProtoBuf {
|
||||
return superNameId_;
|
||||
}
|
||||
|
||||
public static final int INTERFACE_NAME_ID_FIELD_NUMBER = 4;
|
||||
private java.util.List<java.lang.Integer> interfaceNameId_;
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public java.util.List<java.lang.Integer>
|
||||
getInterfaceNameIdList() {
|
||||
return interfaceNameId_;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public int getInterfaceNameIdCount() {
|
||||
return interfaceNameId_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public int getInterfaceNameId(int index) {
|
||||
return interfaceNameId_.get(index);
|
||||
}
|
||||
|
||||
public static final int POST_DECLARATION_BLOCK_FIELD_NUMBER = 3;
|
||||
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock postDeclarationBlock_;
|
||||
/**
|
||||
@@ -45019,6 +45078,7 @@ public final class DebugJsAstProtoBuf {
|
||||
private void initFields() {
|
||||
nameId_ = 0;
|
||||
superNameId_ = 0;
|
||||
interfaceNameId_ = java.util.Collections.emptyList();
|
||||
postDeclarationBlock_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
@@ -45053,6 +45113,9 @@ public final class DebugJsAstProtoBuf {
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
output.writeMessage(3, postDeclarationBlock_);
|
||||
}
|
||||
for (int i = 0; i < interfaceNameId_.size(); i++) {
|
||||
output.writeInt32(4, interfaceNameId_.get(i));
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@@ -45074,6 +45137,15 @@ public final class DebugJsAstProtoBuf {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(3, postDeclarationBlock_);
|
||||
}
|
||||
{
|
||||
int dataSize = 0;
|
||||
for (int i = 0; i < interfaceNameId_.size(); i++) {
|
||||
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32SizeNoTag(interfaceNameId_.get(i));
|
||||
}
|
||||
size += dataSize;
|
||||
size += 1 * getInterfaceNameIdList().size();
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -45196,12 +45268,14 @@ public final class DebugJsAstProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
superNameId_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000002);
|
||||
interfaceNameId_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
if (postDeclarationBlockBuilder_ == null) {
|
||||
postDeclarationBlock_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance();
|
||||
} else {
|
||||
postDeclarationBlockBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
bitField0_ = (bitField0_ & ~0x00000008);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -45238,7 +45312,12 @@ public final class DebugJsAstProtoBuf {
|
||||
to_bitField0_ |= 0x00000002;
|
||||
}
|
||||
result.superNameId_ = superNameId_;
|
||||
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
interfaceNameId_ = java.util.Collections.unmodifiableList(interfaceNameId_);
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
}
|
||||
result.interfaceNameId_ = interfaceNameId_;
|
||||
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
to_bitField0_ |= 0x00000004;
|
||||
}
|
||||
if (postDeclarationBlockBuilder_ == null) {
|
||||
@@ -45268,6 +45347,16 @@ public final class DebugJsAstProtoBuf {
|
||||
if (other.hasSuperNameId()) {
|
||||
setSuperNameId(other.getSuperNameId());
|
||||
}
|
||||
if (!other.interfaceNameId_.isEmpty()) {
|
||||
if (interfaceNameId_.isEmpty()) {
|
||||
interfaceNameId_ = other.interfaceNameId_;
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
} else {
|
||||
ensureInterfaceNameIdIsMutable();
|
||||
interfaceNameId_.addAll(other.interfaceNameId_);
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
if (other.hasPostDeclarationBlock()) {
|
||||
mergePostDeclarationBlock(other.getPostDeclarationBlock());
|
||||
}
|
||||
@@ -45372,6 +45461,72 @@ public final class DebugJsAstProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.util.List<java.lang.Integer> interfaceNameId_ = java.util.Collections.emptyList();
|
||||
private void ensureInterfaceNameIdIsMutable() {
|
||||
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
interfaceNameId_ = new java.util.ArrayList<java.lang.Integer>(interfaceNameId_);
|
||||
bitField0_ |= 0x00000004;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public java.util.List<java.lang.Integer>
|
||||
getInterfaceNameIdList() {
|
||||
return java.util.Collections.unmodifiableList(interfaceNameId_);
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public int getInterfaceNameIdCount() {
|
||||
return interfaceNameId_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public int getInterfaceNameId(int index) {
|
||||
return interfaceNameId_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public Builder setInterfaceNameId(
|
||||
int index, int value) {
|
||||
ensureInterfaceNameIdIsMutable();
|
||||
interfaceNameId_.set(index, value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public Builder addInterfaceNameId(int value) {
|
||||
ensureInterfaceNameIdIsMutable();
|
||||
interfaceNameId_.add(value);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public Builder addAllInterfaceNameId(
|
||||
java.lang.Iterable<? extends java.lang.Integer> values) {
|
||||
ensureInterfaceNameIdIsMutable();
|
||||
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
|
||||
values, interfaceNameId_);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated int32 interface_name_id = 4;</code>
|
||||
*/
|
||||
public Builder clearInterfaceNameId() {
|
||||
interfaceNameId_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock postDeclarationBlock_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlockOrBuilder> postDeclarationBlockBuilder_;
|
||||
@@ -45379,7 +45534,7 @@ public final class DebugJsAstProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock post_declaration_block = 3;</code>
|
||||
*/
|
||||
public boolean hasPostDeclarationBlock() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock post_declaration_block = 3;</code>
|
||||
@@ -45404,7 +45559,7 @@ public final class DebugJsAstProtoBuf {
|
||||
} else {
|
||||
postDeclarationBlockBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
bitField0_ |= 0x00000008;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -45418,7 +45573,7 @@ public final class DebugJsAstProtoBuf {
|
||||
} else {
|
||||
postDeclarationBlockBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
bitField0_ |= 0x00000008;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -45426,7 +45581,7 @@ public final class DebugJsAstProtoBuf {
|
||||
*/
|
||||
public Builder mergePostDeclarationBlock(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock value) {
|
||||
if (postDeclarationBlockBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004) &&
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008) &&
|
||||
postDeclarationBlock_ != org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance()) {
|
||||
postDeclarationBlock_ =
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.newBuilder(postDeclarationBlock_).mergeFrom(value).buildPartial();
|
||||
@@ -45437,7 +45592,7 @@ public final class DebugJsAstProtoBuf {
|
||||
} else {
|
||||
postDeclarationBlockBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00000004;
|
||||
bitField0_ |= 0x00000008;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -45450,14 +45605,14 @@ public final class DebugJsAstProtoBuf {
|
||||
} else {
|
||||
postDeclarationBlockBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
bitField0_ = (bitField0_ & ~0x00000008);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock post_declaration_block = 3;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.Builder getPostDeclarationBlockBuilder() {
|
||||
bitField0_ |= 0x00000004;
|
||||
bitField0_ |= 0x00000008;
|
||||
onChanged();
|
||||
return getPostDeclarationBlockFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -49376,33 +49531,34 @@ public final class DebugJsAstProtoBuf {
|
||||
"expression\030\002 \002(\01325.org.jetbrains.kotlin." +
|
||||
"serialization.js.ast.Expression\"3\n\013NameB" +
|
||||
"inding\022\024\n\014signature_id\030\001 \002(\005\022\016\n\006nameId\030\002" +
|
||||
" \002(\005\"\214\001\n\nClassModel\022\017\n\007name_id\030\001 \002(\005\022\025\n\r" +
|
||||
"super_name_id\030\002 \001(\005\022V\n\026post_declaration_" +
|
||||
"block\030\003 \001(\01326.org.jetbrains.kotlin.seria" +
|
||||
"lization.js.ast.GlobalBlock\";\n\014InlineMod" +
|
||||
"ule\022\024\n\014signature_id\030\001 \002(\005\022\025\n\rexpression_" +
|
||||
"id\030\002 \002(\005\"\034\n\013StringTable\022\r\n\005entry\030\001 \003(\t\"K" +
|
||||
"\n\tNameTable\022>\n\005entry\030\001 \003(\0132/.org.jetbrai",
|
||||
"ns.kotlin.serialization.js.ast.Name\"\263\001\n\004" +
|
||||
"Name\022\021\n\ttemporary\030\001 \002(\010\022\022\n\nidentifier\030\002 " +
|
||||
"\001(\005\022\025\n\rlocal_name_id\030\003 \001(\005\022\027\n\010imported\030\004" +
|
||||
" \001(\010:\005false\022T\n\020special_function\030\005 \001(\0162:." +
|
||||
"org.jetbrains.kotlin.serialization.js.as" +
|
||||
"t.SpecialFunction\"\346\001\n\005Chunk\022L\n\014string_ta" +
|
||||
"ble\030\001 \002(\01326.org.jetbrains.kotlin.seriali" +
|
||||
"zation.js.ast.StringTable\022H\n\nname_table\030" +
|
||||
"\002 \002(\01324.org.jetbrains.kotlin.serializati" +
|
||||
"on.js.ast.NameTable\022E\n\010fragment\030\003 \002(\01323.",
|
||||
"org.jetbrains.kotlin.serialization.js.as" +
|
||||
"t.Fragment*@\n\013SideEffects\022\021\n\rAFFECTS_STA" +
|
||||
"TE\020\001\022\024\n\020DEPENDS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016" +
|
||||
"InlineStrategy\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PL" +
|
||||
"ACE\020\001\022\016\n\nNOT_INLINE\020\002*\275\001\n\017SpecialFunctio" +
|
||||
"n\022\032\n\026DEFINE_INLINE_FUNCTION\020\001\022\021\n\rWRAP_FU" +
|
||||
"NCTION\020\002\022\021\n\rTO_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHA" +
|
||||
"R\020\004\022\020\n\014SUSPEND_CALL\020\005\022\024\n\020COROUTINE_RESUL" +
|
||||
"T\020\006\022\030\n\024COROUTINE_CONTROLLER\020\007\022\026\n\022COROUTI" +
|
||||
"NE_RECEIVER\020\010B\024B\022DebugJsAstProtoBuf"
|
||||
" \002(\005\"\247\001\n\nClassModel\022\017\n\007name_id\030\001 \002(\005\022\025\n\r" +
|
||||
"super_name_id\030\002 \001(\005\022\031\n\021interface_name_id" +
|
||||
"\030\004 \003(\005\022V\n\026post_declaration_block\030\003 \001(\01326" +
|
||||
".org.jetbrains.kotlin.serialization.js.a" +
|
||||
"st.GlobalBlock\";\n\014InlineModule\022\024\n\014signat" +
|
||||
"ure_id\030\001 \002(\005\022\025\n\rexpression_id\030\002 \002(\005\"\034\n\013S" +
|
||||
"tringTable\022\r\n\005entry\030\001 \003(\t\"K\n\tNameTable\022>",
|
||||
"\n\005entry\030\001 \003(\0132/.org.jetbrains.kotlin.ser" +
|
||||
"ialization.js.ast.Name\"\263\001\n\004Name\022\021\n\ttempo" +
|
||||
"rary\030\001 \002(\010\022\022\n\nidentifier\030\002 \001(\005\022\025\n\rlocal_" +
|
||||
"name_id\030\003 \001(\005\022\027\n\010imported\030\004 \001(\010:\005false\022T" +
|
||||
"\n\020special_function\030\005 \001(\0162:.org.jetbrains" +
|
||||
".kotlin.serialization.js.ast.SpecialFunc" +
|
||||
"tion\"\346\001\n\005Chunk\022L\n\014string_table\030\001 \002(\01326.o" +
|
||||
"rg.jetbrains.kotlin.serialization.js.ast" +
|
||||
".StringTable\022H\n\nname_table\030\002 \002(\01324.org.j" +
|
||||
"etbrains.kotlin.serialization.js.ast.Nam",
|
||||
"eTable\022E\n\010fragment\030\003 \002(\01323.org.jetbrains" +
|
||||
".kotlin.serialization.js.ast.Fragment*@\n" +
|
||||
"\013SideEffects\022\021\n\rAFFECTS_STATE\020\001\022\024\n\020DEPEN" +
|
||||
"DS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016InlineStrateg" +
|
||||
"y\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PLACE\020\001\022\016\n\nNOT_" +
|
||||
"INLINE\020\002*\275\001\n\017SpecialFunction\022\032\n\026DEFINE_I" +
|
||||
"NLINE_FUNCTION\020\001\022\021\n\rWRAP_FUNCTION\020\002\022\021\n\rT" +
|
||||
"O_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n\014SUSPEN" +
|
||||
"D_CALL\020\005\022\024\n\020COROUTINE_RESULT\020\006\022\030\n\024COROUT" +
|
||||
"INE_CONTROLLER\020\007\022\026\n\022COROUTINE_RECEIVER\020\010",
|
||||
"B\024B\022DebugJsAstProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -49715,7 +49871,7 @@ public final class DebugJsAstProtoBuf {
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_ClassModel_fieldAccessorTable = new
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_ClassModel_descriptor,
|
||||
new java.lang.String[] { "NameId", "SuperNameId", "PostDeclarationBlock", });
|
||||
new java.lang.String[] { "NameId", "SuperNameId", "InterfaceNameId", "PostDeclarationBlock", });
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_InlineModule_descriptor =
|
||||
getDescriptor().getMessageTypes().get(50);
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_InlineModule_fieldAccessorTable = new
|
||||
|
||||
@@ -478,7 +478,9 @@ fun jdkPath(version: String): String = jdkPathIfFound(version)
|
||||
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.isFork = true
|
||||
options.forkOptions.javaHome = file(javaHome)
|
||||
options.compilerArgs.add("-proc:none")
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
buildscript {
|
||||
val buildSrcKotlinVersion: String by extra(findProperty("buildSrc.kotlin.version")?.toString() ?: embeddedKotlinVersion)
|
||||
extra["buildSrcKotlinRepo"] = findProperty("buildSrc.kotlin.repo")
|
||||
extra["versions.shadow"] = "2.0.1"
|
||||
|
||||
repositories {
|
||||
extra["buildSrcKotlinRepo"]?.let {
|
||||
@@ -34,6 +35,7 @@ repositories {
|
||||
}
|
||||
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") // for dex-method-list
|
||||
// maven { setUrl("https://repo.gradle.org/gradle/libs-releases-local") }
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -42,6 +44,7 @@ dependencies {
|
||||
// compile("net.rubygrapefruit:native-platform:0.14")
|
||||
// TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment
|
||||
// compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["bootstrap_kotlin_version"]}")
|
||||
compile("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
|
||||
}
|
||||
|
||||
samWithReceiver {
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
|
||||
import org.gradle.api.*
|
||||
import org.gradle.api.artifacts.ConfigurablePublishArtifact
|
||||
import org.gradle.api.artifacts.*
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.ConfigurationContainer
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact
|
||||
import org.gradle.api.plugins.BasePluginConvention
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
@@ -61,18 +59,13 @@ fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: Configurab
|
||||
addArtifact("runtimeJar", task, artifactRef, body)
|
||||
}
|
||||
|
||||
fun Project.buildVersion(): Dependency {
|
||||
val cfg = configurations.create("build-version")
|
||||
return dependencies.add(cfg.name, dependencies.project(":prepare:build.version", configuration = "buildVersion"))
|
||||
}
|
||||
|
||||
fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
|
||||
val buildVersionCfg = configurations.create("buildVersion")
|
||||
dependencies.add(buildVersionCfg.name, dependencies.project(":prepare:build.version", configuration = "buildVersion"))
|
||||
extra["runtimeJarTask"] = task
|
||||
tasks.findByName("jar")?.let { defaultJarTask ->
|
||||
configurations.getOrCreate("archives").artifacts.removeAll { (it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false }
|
||||
}
|
||||
return task.apply {
|
||||
setupPublicJar()
|
||||
from(buildVersionCfg) { into("META-INF") }
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
body()
|
||||
project.runtimeJarArtifactBy(this, this)
|
||||
@@ -139,7 +132,7 @@ fun Project.ideaPlugin(subdir: String = "lib", body: AbstractCopyTask.() -> Unit
|
||||
|
||||
task("idea-plugin") {
|
||||
dependsOn(pluginTask)
|
||||
}
|
||||
}
|
||||
|
||||
return pluginTask
|
||||
}
|
||||
|
||||
130
buildSrc/src/main/kotlin/embeddable.kt
Normal file
130
buildSrc/src/main/kotlin/embeddable.kt
Normal file
@@ -0,0 +1,130 @@
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.tasks.bundling.Zip
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.gradle.kotlin.dsl.task
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
|
||||
|
||||
val packagesToRelocate =
|
||||
listOf( "com.intellij",
|
||||
"com.google",
|
||||
"com.sampullara",
|
||||
"org.apache",
|
||||
"org.jdom",
|
||||
"org.picocontainer",
|
||||
"jline",
|
||||
"gnu",
|
||||
"org.fusesource")
|
||||
|
||||
// The shaded compiler "dummy" is used to rewrite dependencies in projects that are used with the embeddable compiler
|
||||
// on the runtime and use some shaded dependencies from the compiler
|
||||
// To speed-up rewriting process we want to have this dummy as small as possible.
|
||||
// But due to the shadow plugin bug (https://github.com/johnrengelman/shadow/issues/262) it is not possible to use
|
||||
// packagesToRelocate list to for the include list. Therefore the exclude list has to be created.
|
||||
val packagesToExcludeFromDummy =
|
||||
listOf("org/jetbrains/kotlin/**",
|
||||
"org/intellij/lang/annotations/**",
|
||||
"org/jetbrains/jps/**",
|
||||
"META-INF/**",
|
||||
"com/sun/jna/**",
|
||||
"com/thoughtworks/xstream/**",
|
||||
"javaslang/**",
|
||||
"*.proto",
|
||||
"messages/**",
|
||||
"net/sf/cglib/**",
|
||||
"one/util/streamex/**",
|
||||
"org/iq80/snappy/**",
|
||||
"org/jline/**",
|
||||
"org/json/**",
|
||||
"org/xmlpull/**",
|
||||
"*.txt")
|
||||
|
||||
private fun ShadowJar.configureEmbeddableCompilerRelocation(withJavaxInject: Boolean = true) {
|
||||
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
|
||||
packagesToRelocate.forEach {
|
||||
relocate(it, "$kotlinEmbeddableRootPackage.$it")
|
||||
}
|
||||
if (withJavaxInject) {
|
||||
relocate("javax.inject", "$kotlinEmbeddableRootPackage.javax.inject")
|
||||
}
|
||||
relocate("org.fusesource", "$kotlinEmbeddableRootPackage.org.fusesource") {
|
||||
// TODO: remove "it." after #KT-12848 get addressed
|
||||
exclude("org.fusesource.jansi.internal.CLibrary")
|
||||
}
|
||||
}
|
||||
|
||||
private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Unit): Jar {
|
||||
|
||||
val compilerJar = configurations.getOrCreate("compilerJar")
|
||||
dependencies.add(compilerJar.name, dependencies.project(":kotlin-compiler", configuration = "runtimeJar"))
|
||||
|
||||
return task<ShadowJar>(taskName) {
|
||||
destinationDir = File(buildDir, "libs")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(compilerJar)
|
||||
body()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): Jar =
|
||||
compilerShadowJar(taskName) {
|
||||
configureEmbeddableCompilerRelocation()
|
||||
body()
|
||||
}
|
||||
|
||||
fun Project.compilerDummyForDependenciesRewriting(taskName: String = "compilerDummy", body: ShadowJar.() -> Unit = {}): Jar =
|
||||
compilerShadowJar(taskName) {
|
||||
exclude(packagesToExcludeFromDummy)
|
||||
body()
|
||||
}
|
||||
|
||||
const val COMPILER_DUMMY_JAR_CONFIGURATION_NAME = "compilerDummyJar"
|
||||
|
||||
fun Project.compilerDummyJar(task: Jar, body: Jar.() -> Unit = {}) {
|
||||
task.body()
|
||||
addArtifact(COMPILER_DUMMY_JAR_CONFIGURATION_NAME, task, task)
|
||||
}
|
||||
|
||||
fun Project.embeddableCompilerDummyForDependenciesRewriting(taskName: String = "embeddable", body: Jar.() -> Unit = {}): Jar {
|
||||
val compilerDummyJar = configurations.getOrCreate("compilerDummyJar")
|
||||
dependencies.add(compilerDummyJar.name,
|
||||
dependencies.project(":kotlin-compiler-embeddable", configuration = COMPILER_DUMMY_JAR_CONFIGURATION_NAME))
|
||||
|
||||
return task<ShadowJar>(taskName) {
|
||||
destinationDir = File(buildDir, "libs")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(compilerDummyJar)
|
||||
configureEmbeddableCompilerRelocation(withJavaxInject = false)
|
||||
body()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Zip, body: Jar.() -> Unit = {}): Jar {
|
||||
val originalFiles by lazy {
|
||||
val jarContents = zipTree(originalJarTask.outputs.files.singleFile).files
|
||||
val basePath = jarContents.find { it.name == "MANIFEST.MF" }?.parentFile?.parentFile ?: throw GradleException("cannot determine the jar root dir")
|
||||
jarContents.map { it.relativeTo(basePath).path }.toSet()
|
||||
}
|
||||
return task<Jar>("rewrittenDepsJar") {
|
||||
originalJarTask.apply {
|
||||
classifier = "original"
|
||||
}
|
||||
shadowJarTask.apply {
|
||||
dependsOn(originalJarTask)
|
||||
from(originalJarTask)// { include("**") }
|
||||
classifier = "shadow"
|
||||
}
|
||||
dependsOn(shadowJarTask)
|
||||
from(project.zipTree(shadowJarTask.outputs.files.singleFile)) { include { originalFiles.any { originalFile -> it.file.canonicalPath.endsWith(originalFile) } } }
|
||||
body()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.rewriteDepsToShadedCompiler(originalJarTask: Jar, body: Jar.() -> Unit = {}): Jar =
|
||||
rewriteDepsToShadedJar(originalJarTask, embeddableCompilerDummyForDependenciesRewriting(), body)
|
||||
@@ -51,6 +51,7 @@ import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.codegen.when.SwitchCodegen;
|
||||
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
|
||||
import org.jetbrains.kotlin.config.ApiVersion;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor;
|
||||
@@ -307,7 +308,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
RuntimeAssertionInfo runtimeAssertionInfo = null;
|
||||
if (selector instanceof KtExpression) {
|
||||
runtimeAssertionInfo = bindingContext.get(JvmBindingContextSlices.RUNTIME_ASSERTION_INFO, (KtExpression) selector);
|
||||
KtExpression expression = (KtExpression) selector;
|
||||
runtimeAssertionInfo = bindingContext.get(JvmBindingContextSlices.RUNTIME_ASSERTION_INFO, expression);
|
||||
if (runtimeAssertionInfo == null &&
|
||||
state.getLanguageVersionSettings().supportsFeature(LanguageFeature.StrictJavaNullabilityAssertions)) {
|
||||
runtimeAssertionInfo = bindingContext.get(JvmBindingContextSlices.BODY_RUNTIME_ASSERTION_INFO, expression);
|
||||
}
|
||||
}
|
||||
|
||||
if (BuiltinSpecialBridgesKt.isValueArgumentForCallToMethodWithTypeCheckBarrier(selector, bindingContext)) return stackValue;
|
||||
@@ -1717,12 +1723,22 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
|
||||
private boolean shouldGenerateSingletonAsThisOrOuterFromContext(ClassDescriptor classDescriptor) {
|
||||
return isPossiblyUninitializedSingleton(classDescriptor) &&
|
||||
isInsideSingleton(classDescriptor) &&
|
||||
isThisInitialized(classDescriptor);
|
||||
}
|
||||
if (!isPossiblyUninitializedSingleton(classDescriptor)) return false;
|
||||
if (!isInsideSingleton(classDescriptor)) return false;
|
||||
|
||||
// We are inside a singleton class 'S' with possibly uninitialized static instance
|
||||
// (enum entry, interface companion object).
|
||||
// Such singleton can be referenced by name, or as an explicit or implicit 'this'.
|
||||
// For a given singleton class 'S' we either use 'this@S' from context (local or captured),
|
||||
// or 'S' as a static instance.
|
||||
//
|
||||
// Local or captured 'this@S' should be used if:
|
||||
// - we are in the constructor for 'S',
|
||||
// and corresponding instance is initialized by super or delegating constructor call;
|
||||
// - we are in any other member of 'S' or any of its inner classes.
|
||||
//
|
||||
// Otherwise, a static instance should be used.
|
||||
|
||||
private boolean isThisInitialized(ClassDescriptor classDescriptor) {
|
||||
CodegenContext context = this.context;
|
||||
while (context != null) {
|
||||
if (context instanceof ConstructorContext) {
|
||||
@@ -1732,9 +1748,24 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
return constructorContext.isThisInitialized();
|
||||
}
|
||||
}
|
||||
else if (context instanceof ClassContext) {
|
||||
ClassDescriptor contextClass = ((ClassContext) context).getContextDescriptor();
|
||||
if (isInInnerClassesChainFor(contextClass, classDescriptor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
context = context.getParentContext();
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isInInnerClassesChainFor(ClassDescriptor innerClass, ClassDescriptor outerClass) {
|
||||
if (innerClass == outerClass) return true;
|
||||
if (!innerClass.isInner()) return false;
|
||||
|
||||
DeclarationDescriptor containingDeclaration = innerClass.getContainingDeclaration();
|
||||
if (!(containingDeclaration instanceof ClassDescriptor)) return false;
|
||||
return isInInnerClassesChainFor((ClassDescriptor) containingDeclaration, outerClass);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -2784,7 +2815,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private StackValue generateCallableReferenceReceiver(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
public StackValue generateCallableReferenceReceiver(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
CallableDescriptor descriptor = resolvedCall.getResultingDescriptor();
|
||||
if (descriptor.getExtensionReceiverParameter() == null && descriptor.getDispatchReceiverParameter() == null) return null;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.TypeMapperUtilsKt;
|
||||
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
|
||||
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.coroutines.CoroutineUtilKt;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
@@ -56,6 +57,7 @@ import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.EnumValue;
|
||||
import org.jetbrains.kotlin.resolve.constants.NullValue;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionsOnDeclarationBodyChecker;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
@@ -86,6 +88,8 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
private final JvmRuntimeTypes runtimeTypes;
|
||||
private final TypeMappingConfiguration<Type> typeMappingConfiguration;
|
||||
private final SwitchCodegenProvider switchCodegenProvider;
|
||||
private final LanguageVersionSettings languageVersionSettings;
|
||||
private final ClassBuilderMode classBuilderMode;
|
||||
|
||||
public CodegenAnnotatingVisitor(@NotNull GenerationState state) {
|
||||
this.bindingTrace = state.getBindingTrace();
|
||||
@@ -94,6 +98,8 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
this.runtimeTypes = state.getJvmRuntimeTypes();
|
||||
this.typeMappingConfiguration = state.getTypeMapper().getTypeMappingConfiguration();
|
||||
this.switchCodegenProvider = new SwitchCodegenProvider(state);
|
||||
this.languageVersionSettings = state.getLanguageVersionSettings();
|
||||
this.classBuilderMode = state.getClassBuilderMode();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -411,6 +417,8 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
// working around a problem with shallow analysis
|
||||
if (descriptor == null) return;
|
||||
|
||||
checkRuntimeAsserionsOnDeclarationBody(property, descriptor);
|
||||
|
||||
if (descriptor instanceof LocalVariableDescriptor) {
|
||||
recordLocalVariablePropertyMetadata((LocalVariableDescriptor) descriptor);
|
||||
}
|
||||
@@ -447,6 +455,14 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
nameStack.pop();
|
||||
}
|
||||
|
||||
private void checkRuntimeAsserionsOnDeclarationBody(@NotNull KtDeclaration declaration, DeclarationDescriptor descriptor) {
|
||||
if (classBuilderMode.generateBodies) {
|
||||
// NB This is required only for bodies generation.
|
||||
// In light class generation can cause recursion in types resolution.
|
||||
RuntimeAssertionsOnDeclarationBodyChecker.check(declaration, descriptor, bindingTrace, languageVersionSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Type getMetadataOwner(@NotNull KtProperty property) {
|
||||
for (int i = classStack.size() - 1; i >= 0; i--) {
|
||||
@@ -469,12 +485,24 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
|
||||
return Type.getObjectType(JvmFileClassUtil.getFileClassInternalName(property.getContainingKtFile()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPropertyAccessor(@NotNull KtPropertyAccessor accessor) {
|
||||
PropertyAccessorDescriptor accessorDescriptor = bindingContext.get(PROPERTY_ACCESSOR, accessor);
|
||||
if (accessorDescriptor != null) {
|
||||
checkRuntimeAsserionsOnDeclarationBody(accessor, accessorDescriptor);
|
||||
}
|
||||
|
||||
super.visitPropertyAccessor(accessor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitNamedFunction(@NotNull KtNamedFunction function) {
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, function);
|
||||
// working around a problem with shallow analysis
|
||||
if (functionDescriptor == null) return;
|
||||
|
||||
checkRuntimeAsserionsOnDeclarationBody(function, functionDescriptor);
|
||||
|
||||
String nameForClassOrPackageMember = getNameForClassOrPackageMember(functionDescriptor);
|
||||
|
||||
if (functionDescriptor instanceof SimpleFunctionDescriptor && functionDescriptor.isSuspend()) {
|
||||
|
||||
@@ -36,9 +36,9 @@ object LateinitIsInitialized : IntrinsicPropertyGetter() {
|
||||
private fun getStackValue(resolvedCall: ResolvedCall<*>, codegen: ExpressionCodegen): StackValue? {
|
||||
val expression =
|
||||
(resolvedCall.extensionReceiver as? ExpressionReceiver)?.expression as? KtCallableReferenceExpression ?: return null
|
||||
val referenceResolvedCall = expression.callableReference.getResolvedCallWithAssert(codegen.bindingContext)
|
||||
|
||||
// TODO: support properties imported from objects as soon as KT-18982 is fixed
|
||||
val receiver = expression.receiverExpression?.let(codegen::gen) ?: StackValue.none()
|
||||
val receiver = codegen.generateCallableReferenceReceiver(referenceResolvedCall) ?: StackValue.none()
|
||||
|
||||
val target = expression.callableReference.getResolvedCallWithAssert(codegen.bindingContext).resultingDescriptor
|
||||
return codegen.intermediateValueForProperty(target as PropertyDescriptor, true, false, null, false, receiver, null, true)
|
||||
|
||||
@@ -79,18 +79,22 @@ class PopBackwardPropagationTransformer : MethodTransformer() {
|
||||
private fun analyzeMethodBody(): Array<out Frame<SourceValue>?> {
|
||||
val frames = Analyzer<SourceValue>(HazardsTrackingInterpreter()).analyze("fake", methodNode)
|
||||
|
||||
postprocessDupNxM(frames)
|
||||
postprocessStackHazards(frames)
|
||||
|
||||
return frames
|
||||
}
|
||||
|
||||
private fun postprocessDupNxM(frames: Array<out Frame<SourceValue>?>) {
|
||||
private fun postprocessStackHazards(frames: Array<out Frame<SourceValue>?>) {
|
||||
val insns = methodNode.instructions.toArray()
|
||||
for (i in frames.indices) {
|
||||
val frame = frames[i] ?: continue
|
||||
val insn = insns[i]
|
||||
|
||||
when (insn.opcode) {
|
||||
Opcodes.POP2 -> {
|
||||
val top2 = frame.peekWords(2) ?: throwIncorrectBytecode(insn, frame)
|
||||
top2.forEach { it.insns.markAsDontTouch() }
|
||||
}
|
||||
Opcodes.DUP_X1 -> {
|
||||
val top2 = frame.peekWords(1, 1) ?: throwIncorrectBytecode(insn, frame)
|
||||
top2.forEach { it.insns.markAsDontTouch() }
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.config.shouldWritePreReleaseFlag
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
|
||||
@@ -37,7 +36,7 @@ fun writeKotlinMetadata(
|
||||
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
||||
var flags = extraFlags
|
||||
if (KotlinCompilerVersion.isPreRelease() && state.languageVersionSettings.languageVersion == LanguageVersion.LATEST_STABLE) {
|
||||
if (state.languageVersionSettings.shouldWritePreReleaseFlag()) {
|
||||
flags = flags or JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG
|
||||
}
|
||||
if (flags != 0) {
|
||||
@@ -51,4 +50,4 @@ fun writeSyntheticClassMetadata(cb: ClassBuilder, state: GenerationState) {
|
||||
writeKotlinMetadata(cb, state, KotlinClassHeader.Kind.SYNTHETIC_CLASS, 0) { _ ->
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,16 +106,16 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
|
||||
@Argument(value = "-Xno-param-assertions", description = "Don't generate not-null assertions on parameters of methods accessible from Java")
|
||||
var noParamAssertions: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(value = "-Xstrict-java-nullability-assertions", description = "Generate nullability assertions for non-null Java expressions")
|
||||
var strictJavaNullabilityAssertions: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(value = "-Xno-optimize", description = "Disable optimizations")
|
||||
var noOptimize: Boolean by FreezableVar(false)
|
||||
|
||||
@Argument(
|
||||
value = "-Xnormalize-constructor-calls",
|
||||
valueDescription = "{disable|enable|preserve-class-initialization}",
|
||||
description = "Normalize constructor calls " +
|
||||
"(disable: don't normalize; enable: normalize; " +
|
||||
"preserve-class-initialization: normalize preserving class initialization order), " +
|
||||
"default is disable"
|
||||
valueDescription = "{disable|enable}",
|
||||
description = "Normalize constructor calls (disable: don't normalize; enable: normalize), default is disable"
|
||||
)
|
||||
var constructorCallNormalizationMode: String? by FreezableVar(JVMConstructorCallNormalizationMode.DEFAULT.description)
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Note that this file is also present in idea/src/META-INF/services
|
||||
org.jetbrains.kotlin.resolve.jvm.diagnostics.DefaultErrorMessagesJvm
|
||||
org.jetbrains.kotlin.js.resolve.diagnostics.DefaultErrorMessagesJs
|
||||
@@ -204,6 +204,8 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
|
||||
extraLanguageFeatures.put(LanguageFeature.Coroutines, coroutinesState);
|
||||
}
|
||||
|
||||
setupPlatformSpecificLanguageFeatureSettings(extraLanguageFeatures, arguments);
|
||||
|
||||
CommonConfigurationKeysKt.setLanguageVersionSettings(configuration, new LanguageVersionSettingsImpl(
|
||||
languageVersion,
|
||||
ApiVersion.createByLanguageVersion(apiVersion),
|
||||
@@ -212,6 +214,13 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
|
||||
));
|
||||
}
|
||||
|
||||
protected void setupPlatformSpecificLanguageFeatureSettings(
|
||||
@NotNull Map<LanguageFeature, LanguageFeature.State> extraLanguageFeatures,
|
||||
@NotNull A commandLineArguments
|
||||
) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static KotlinPaths computeKotlinPaths(@NotNull MessageCollector messageCollector, @NotNull CommonCompilerArguments arguments) {
|
||||
KotlinPaths paths;
|
||||
|
||||
@@ -228,6 +228,17 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setupPlatformSpecificLanguageFeatureSettings(
|
||||
extraLanguageFeatures: MutableMap<LanguageFeature, LanguageFeature.State>,
|
||||
commandLineArguments: K2JVMCompilerArguments
|
||||
) {
|
||||
if (commandLineArguments.strictJavaNullabilityAssertions) {
|
||||
extraLanguageFeatures[LanguageFeature.StrictJavaNullabilityAssertions] = LanguageFeature.State.ENABLED
|
||||
}
|
||||
|
||||
super.setupPlatformSpecificLanguageFeatureSettings(extraLanguageFeatures, commandLineArguments)
|
||||
}
|
||||
|
||||
private fun registerJavacIfNeeded(environment: KotlinCoreEnvironment,
|
||||
arguments: K2JVMCompilerArguments): Boolean {
|
||||
if (arguments.useJavac) {
|
||||
@@ -374,8 +385,6 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
configuration.put(JVMConfigurationKeys.ADD_BUILT_INS_FROM_COMPILER_TO_DEPENDENCIES, arguments.addCompilerBuiltIns)
|
||||
configuration.put(JVMConfigurationKeys.CREATE_BUILT_INS_FROM_MODULE_DEPENDENCIES, arguments.loadBuiltInsFromDependencies)
|
||||
|
||||
|
||||
|
||||
arguments.declarationsOutputPath?.let { configuration.put(JVMConfigurationKeys.DECLARATIONS_JSON_PATH, it) }
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
||||
|
||||
private val binaryCache: MutableMap<ClassId, JavaClass?> = THashMap()
|
||||
private val signatureParsingComponent =
|
||||
BinaryClassSignatureParser(ClassifierResolutionContext { findClass(it, allScope) })
|
||||
BinaryClassSignatureParser()
|
||||
|
||||
override fun findClass(classId: ClassId, searchScope: GlobalSearchScope): JavaClass? {
|
||||
val virtualFile = findVirtualFileForTopLevelClass(classId, searchScope) ?: return null
|
||||
|
||||
@@ -153,8 +153,8 @@ class ReplCodeAnalyzer(environment: KotlinCoreEnvironment) {
|
||||
return delegateFactory.getPackageMemberDeclarationProvider(packageFqName)
|
||||
}
|
||||
|
||||
override fun diagnoseMissingPackageFragment(file: KtFile) {
|
||||
delegateFactory.diagnoseMissingPackageFragment(file)
|
||||
override fun diagnoseMissingPackageFragment(fqName: FqName, file: KtFile?) {
|
||||
delegateFactory.diagnoseMissingPackageFragment(fqName, file)
|
||||
}
|
||||
|
||||
class AdaptablePackageMemberDeclarationProvider(
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
description = "Compiler runner + daemon client"
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
@@ -13,6 +15,7 @@ dependencies {
|
||||
compileOnly(project(":compiler:daemon-common"))
|
||||
compile(project(":kotlin-daemon-client"))
|
||||
compileOnly(project(":compiler:util"))
|
||||
runtime(projectRuntimeJar(":kotlin-compiler-embeddable"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -20,10 +23,13 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
runtimeJar {
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
from(getSourceSetsFrom(":kotlin-daemon-client")["main"].output.classesDirs)
|
||||
from(getSourceSetsFrom(":compiler:daemon-common")["main"].output.classesDirs)
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(jar))
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
|
||||
@@ -216,4 +216,9 @@ messages/**)
|
||||
-keep class com.sun.source.** { *; }
|
||||
|
||||
# for coroutines
|
||||
-keep class kotlinx.coroutines.** { *; }
|
||||
-keep class kotlinx.coroutines.** { *; }
|
||||
|
||||
# for webdemo
|
||||
-keep class com.intellij.openapi.progress.ProgressManager { *; }
|
||||
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.java.structure.impl.classFiles
|
||||
|
||||
import com.intellij.psi.CommonClassNames
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaClassifierType
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaType
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaTypeParameter
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
|
||||
import org.jetbrains.kotlin.utils.compact
|
||||
@@ -33,14 +30,11 @@ import java.text.StringCharacterIterator
|
||||
|
||||
/**
|
||||
* Take a look at com.intellij.psi.impl.compiled.SignatureParsing
|
||||
* NOTE: currently this class can simply be converted to an object, but there are postponed plans
|
||||
* to introduce cached instance for java.lang.Object type that would require injected class finder.
|
||||
* So please, do not convert it to object
|
||||
*/
|
||||
class BinaryClassSignatureParser(globalContext: ClassifierResolutionContext) {
|
||||
companion object {
|
||||
private val JAVA_LANG_OBJECT = ClassId.topLevel(FqName(CommonClassNames.JAVA_LANG_OBJECT))
|
||||
}
|
||||
|
||||
private val JAVA_LANG_OBJECT_CLASSIFIER_TYPE: JavaClassifierType =
|
||||
PlainJavaClassifierType({ globalContext.resolveClass(JAVA_LANG_OBJECT) }, emptyList())
|
||||
class BinaryClassSignatureParser {
|
||||
|
||||
fun parseTypeParametersDeclaration(signature: CharacterIterator, context: ClassifierResolutionContext): List<JavaTypeParameter> {
|
||||
if (signature.current() != '<') {
|
||||
@@ -68,25 +62,14 @@ class BinaryClassSignatureParser(globalContext: ClassifierResolutionContext) {
|
||||
val parameterName = name.toString()
|
||||
|
||||
// postpone list allocation till a second bound is seen; ignore sole Object bound
|
||||
var bounds: MutableList<JavaClassifierType>? = null
|
||||
var jlo = false
|
||||
val bounds: MutableList<JavaClassifierType> = ContainerUtil.newSmartList()
|
||||
while (signature.current() == ':') {
|
||||
signature.next()
|
||||
val bound = parseClassifierRefSignature(signature, context) ?: continue
|
||||
if (bounds == null) {
|
||||
if (JAVA_LANG_OBJECT_CLASSIFIER_TYPE === bound) {
|
||||
jlo = true
|
||||
continue
|
||||
}
|
||||
bounds = ContainerUtil.newSmartList()
|
||||
if (jlo) {
|
||||
bounds.add(JAVA_LANG_OBJECT_CLASSIFIER_TYPE)
|
||||
}
|
||||
}
|
||||
bounds.add(bound)
|
||||
}
|
||||
|
||||
return BinaryJavaTypeParameter(Name.identifier(parameterName), bounds ?: emptyList())
|
||||
return BinaryJavaTypeParameter(Name.identifier(parameterName), bounds)
|
||||
}
|
||||
|
||||
fun parseClassifierRefSignature(signature: CharacterIterator, context: ClassifierResolutionContext): JavaClassifierType? {
|
||||
@@ -148,8 +131,6 @@ class BinaryClassSignatureParser(globalContext: ClassifierResolutionContext) {
|
||||
}
|
||||
signature.next()
|
||||
|
||||
if (canonicalName.toString() == "java/lang/Object") return JAVA_LANG_OBJECT_CLASSIFIER_TYPE
|
||||
|
||||
return PlainJavaClassifierType(
|
||||
{ context.resolveByInternalName(canonicalName.toString()) },
|
||||
argumentGroups.reversed().flattenTo(arrayListOf()).compact()
|
||||
|
||||
@@ -32,6 +32,9 @@ object JvmBindingContextSlices {
|
||||
@JvmField
|
||||
val RECEIVER_RUNTIME_ASSERTION_INFO: WritableSlice<ExpressionReceiver, RuntimeAssertionInfo> = BasicWritableSlice(RewritePolicy.DO_NOTHING)
|
||||
|
||||
@JvmField
|
||||
val BODY_RUNTIME_ASSERTION_INFO: WritableSlice<KtExpression, RuntimeAssertionInfo> = BasicWritableSlice(RewritePolicy.DO_NOTHING)
|
||||
|
||||
@JvmField
|
||||
val LOAD_FROM_JAVA_SIGNATURE_ERRORS: WritableSlice<DeclarationDescriptor, List<String>> = Slices.createCollectiveSlice()
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.jvm
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.DeclarationReturnTypeSanitizer
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.WrappedTypeFactory
|
||||
|
||||
object JvmDeclarationReturnTypeSanitizer : DeclarationReturnTypeSanitizer {
|
||||
override fun sanitizeReturnType(
|
||||
inferred: UnwrappedType,
|
||||
wrappedTypeFactory: WrappedTypeFactory,
|
||||
trace: BindingTrace,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): UnwrappedType =
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.StrictJavaNullabilityAssertions)) {
|
||||
// NB can't check for presence of EnhancedNullability here,
|
||||
// because it will also cause recursion in declaration type resolution.
|
||||
inferred.replaceAnnotations(FilteredAnnotations(inferred.annotations) {
|
||||
it != JvmAnnotationNames.ENHANCED_NULLABILITY_ANNOTATION
|
||||
})
|
||||
}
|
||||
else inferred
|
||||
}
|
||||
@@ -18,9 +18,12 @@ package org.jetbrains.kotlin.resolve.jvm
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.java.typeEnhancement.hasEnhancedNullability
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.AdditionalTypeChecker
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
||||
@@ -31,9 +34,9 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.isError
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.isClassType
|
||||
import org.jetbrains.kotlin.types.typeUtil.immediateSupertypes
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
class RuntimeAssertionInfo(val needNotNullAssertion: Boolean, val message: String) {
|
||||
@@ -83,6 +86,9 @@ class RuntimeAssertionInfo(val needNotNullAssertion: Boolean, val message: Strin
|
||||
}
|
||||
}
|
||||
|
||||
private val KtExpression.textForRuntimeAssertionInfo
|
||||
get() = StringUtil.trimMiddle(text, 50)
|
||||
|
||||
class RuntimeAssertionsDataFlowExtras(
|
||||
private val c: ResolutionContext<*>,
|
||||
private val dataFlowValue: DataFlowValue,
|
||||
@@ -93,7 +99,7 @@ class RuntimeAssertionsDataFlowExtras(
|
||||
override val possibleTypes: Set<KotlinType>
|
||||
get() = c.dataFlowInfo.getCollectedTypes(dataFlowValue)
|
||||
override val presentableText: String
|
||||
get() = StringUtil.trimMiddle(expression.text, 50)
|
||||
get() = expression.textForRuntimeAssertionInfo
|
||||
}
|
||||
|
||||
object RuntimeAssertionsTypeChecker : AdditionalTypeChecker {
|
||||
@@ -138,4 +144,101 @@ object RuntimeAssertionsOnExtensionReceiverCallChecker : CallChecker {
|
||||
c.trace.record(JvmBindingContextSlices.RECEIVER_RUNTIME_ASSERTION_INFO, expressionReceiverValue, assertionInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object RuntimeAssertionsOnDeclarationBodyChecker {
|
||||
@JvmStatic
|
||||
fun check(
|
||||
declaration: KtDeclaration,
|
||||
descriptor: DeclarationDescriptor,
|
||||
bindingTrace: BindingTrace,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
if (!languageVersionSettings.supportsFeature(LanguageFeature.StrictJavaNullabilityAssertions)) return
|
||||
|
||||
when {
|
||||
declaration is KtProperty && descriptor is VariableDescriptor ->
|
||||
checkLocalVariable(declaration, descriptor, bindingTrace)
|
||||
declaration is KtFunction && descriptor is FunctionDescriptor ->
|
||||
checkFunction(declaration, descriptor, bindingTrace)
|
||||
declaration is KtProperty && descriptor is PropertyDescriptor ->
|
||||
checkProperty(declaration, descriptor, bindingTrace)
|
||||
declaration is KtPropertyAccessor && descriptor is PropertyAccessorDescriptor ->
|
||||
checkPropertyAccessor(declaration, descriptor, bindingTrace)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkLocalVariable(
|
||||
declaration: KtProperty,
|
||||
descriptor: VariableDescriptor,
|
||||
bindingTrace: BindingTrace
|
||||
) {
|
||||
if (declaration.typeReference != null) return
|
||||
|
||||
checkNullabilityAssertion(declaration.initializer ?: return, descriptor.type, bindingTrace)
|
||||
}
|
||||
|
||||
private fun checkFunction(
|
||||
declaration: KtFunction,
|
||||
descriptor: FunctionDescriptor,
|
||||
bindingTrace: BindingTrace
|
||||
) {
|
||||
if (declaration.typeReference != null || declaration.hasBlockBody()) return
|
||||
|
||||
checkNullabilityAssertion(declaration.bodyExpression ?: return, descriptor.returnType ?: return,
|
||||
bindingTrace)
|
||||
}
|
||||
|
||||
private fun checkProperty(
|
||||
declaration: KtProperty,
|
||||
descriptor: PropertyDescriptor,
|
||||
bindingTrace: BindingTrace
|
||||
) {
|
||||
if (declaration.typeReference != null) return
|
||||
|
||||
// TODO nullability assertion on delegate initialization expression, see KT-20823
|
||||
if (declaration.hasDelegateExpression()) return
|
||||
|
||||
checkNullabilityAssertion(declaration.initializer ?: return, descriptor.type, bindingTrace)
|
||||
}
|
||||
|
||||
private fun checkPropertyAccessor(
|
||||
declaration: KtPropertyAccessor,
|
||||
descriptor: PropertyAccessorDescriptor,
|
||||
bindingTrace: BindingTrace
|
||||
) {
|
||||
if (declaration.property.typeReference != null || declaration.hasBlockBody()) return
|
||||
|
||||
checkNullabilityAssertion(declaration.bodyExpression ?: return, descriptor.correspondingProperty.type,
|
||||
bindingTrace)
|
||||
}
|
||||
|
||||
|
||||
private fun checkNullabilityAssertion(
|
||||
expression: KtExpression,
|
||||
declarationType: KotlinType,
|
||||
bindingTrace: BindingTrace
|
||||
) {
|
||||
if (declarationType.unwrap().canContainNull()) return
|
||||
|
||||
val expressionType = bindingTrace.getType(expression) ?: return
|
||||
if (expressionType.isError) return
|
||||
|
||||
if (!expressionType.hasEnhancedNullability()) return
|
||||
|
||||
bindingTrace.record(
|
||||
JvmBindingContextSlices.BODY_RUNTIME_ASSERTION_INFO,
|
||||
expression,
|
||||
RuntimeAssertionInfo(true, expression.textForRuntimeAssertionInfo)
|
||||
)
|
||||
}
|
||||
|
||||
private fun UnwrappedType.canContainNull(): Boolean {
|
||||
val upper = upperIfFlexible()
|
||||
return when {
|
||||
upper.isMarkedNullable -> true
|
||||
upper.isClassType -> false
|
||||
else -> upper.immediateSupertypes().all { it.unwrap().canContainNull() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,9 @@ object JvmPlatformConfigurator : PlatformConfigurator(
|
||||
|
||||
delegationFilter = JvmDelegationFilter,
|
||||
|
||||
overridesBackwardCompatibilityHelper = JvmOverridesBackwardCompatibilityHelper
|
||||
overridesBackwardCompatibilityHelper = JvmOverridesBackwardCompatibilityHelper,
|
||||
|
||||
declarationReturnTypeSanitizer = JvmDeclarationReturnTypeSanitizer
|
||||
) {
|
||||
override fun configureModuleComponents(container: StorageComponentContainer) {
|
||||
container.useImpl<JvmReflectionAPICallChecker>()
|
||||
|
||||
@@ -190,7 +190,10 @@ class PseudocodeVariablesData(val pseudocode: Pseudocode, private val bindingCon
|
||||
}
|
||||
|
||||
private fun WriteValueInstruction.isTrivialInitializer() =
|
||||
element is KtVariableDeclaration || element is KtParameter
|
||||
// WriteValueInstruction having KtDeclaration as an element means
|
||||
// it must be a write happened at the same time when
|
||||
// the variable (common variable/parameter/object) has been declared
|
||||
element is KtDeclaration
|
||||
|
||||
private inner class ReadOnlyInitControlFlowInfoImpl(
|
||||
val declaredSet: ImmutableSet<VariableDescriptor>,
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
import org.jetbrains.kotlin.config.LanguageVersion;
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer;
|
||||
import org.jetbrains.kotlin.lexer.KtKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
@@ -982,9 +983,9 @@ public interface Errors {
|
||||
DiagnosticFactory1<PsiElement, CallableDescriptor> ILLEGAL_SUSPEND_FUNCTION_CALL = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory2<PsiElement, String, String> PLUGIN_ERROR = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, String, String> PLUGIN_WARNING = DiagnosticFactory2.create(WARNING);
|
||||
DiagnosticFactory2<PsiElement, String, String> PLUGIN_INFO = DiagnosticFactory2.create(INFO);
|
||||
DiagnosticFactory1<PsiElement, RenderedDiagnostic<?>> PLUGIN_ERROR = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, RenderedDiagnostic<?>> PLUGIN_WARNING = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<PsiElement, RenderedDiagnostic<?>> PLUGIN_INFO = DiagnosticFactory1.create(INFO);
|
||||
|
||||
// Function contracts
|
||||
DiagnosticFactory1<KtElement, String> ERROR_IN_CONTRACT_DESCRIPTION = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
@@ -14,6 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package foo
|
||||
package org.jetbrains.kotlin.diagnostics
|
||||
|
||||
class A(val x: String)
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer
|
||||
|
||||
class RenderedDiagnostic<D : Diagnostic>(
|
||||
val diagnostic: D,
|
||||
val renderer: DiagnosticRenderer<D>
|
||||
) {
|
||||
val text = renderer.render(diagnostic)
|
||||
|
||||
val factory: DiagnosticFactory<*> get() = diagnostic.factory
|
||||
|
||||
override fun toString() = text
|
||||
}
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.diagnostics
|
||||
|
||||
import com.intellij.mock.MockApplication
|
||||
import com.intellij.openapi.application.Application
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.builtins.isFunctionType
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
@@ -167,19 +164,15 @@ inline fun <reified T : KtDeclaration> reportOnDeclarationAs(trace: BindingTrace
|
||||
}
|
||||
|
||||
fun <D : Diagnostic> DiagnosticSink.reportFromPlugin(diagnostic: D, ext: DefaultErrorMessages.Extension) {
|
||||
if (ApplicationManager.getApplication() !is MockApplication) {
|
||||
return this.report(diagnostic)
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val renderer = ext.map[diagnostic.factory] as? DiagnosticRenderer<D>
|
||||
?: error("Renderer not found for diagnostic ${diagnostic.factory.name}")
|
||||
|
||||
val text = renderer.render(diagnostic)
|
||||
val renderedDiagnostic = RenderedDiagnostic(diagnostic, renderer)
|
||||
|
||||
when (diagnostic.severity) {
|
||||
Severity.ERROR -> report(Errors.PLUGIN_ERROR.on(diagnostic.psiElement, diagnostic.factory.name, text))
|
||||
Severity.WARNING -> report(Errors.PLUGIN_WARNING.on(diagnostic.psiElement, diagnostic.factory.name, text))
|
||||
Severity.INFO -> report(Errors.PLUGIN_INFO.on(diagnostic.psiElement, diagnostic.factory.name, text))
|
||||
Severity.ERROR -> report(Errors.PLUGIN_ERROR.on(diagnostic.psiElement, renderedDiagnostic))
|
||||
Severity.WARNING -> report(Errors.PLUGIN_WARNING.on(diagnostic.psiElement, renderedDiagnostic))
|
||||
Severity.INFO -> report(Errors.PLUGIN_INFO.on(diagnostic.psiElement, renderedDiagnostic))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,26 +16,27 @@
|
||||
|
||||
package org.jetbrains.kotlin.diagnostics.rendering;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import kotlin.Pair;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.config.LanguageVersion;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.diagnostics.RenderedDiagnostic;
|
||||
import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.VersionRequirement;
|
||||
import org.jetbrains.kotlin.types.KotlinTypeKt;
|
||||
import org.jetbrains.kotlin.util.MappedExtensionProvider;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.AddToStdlibKt;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.diagnostics.rendering.Renderers.*;
|
||||
@@ -44,47 +45,30 @@ import static org.jetbrains.kotlin.diagnostics.rendering.RenderingContext.of;
|
||||
public class DefaultErrorMessages {
|
||||
|
||||
public interface Extension {
|
||||
ExtensionPointName<Extension> EP_NAME = ExtensionPointName.create("org.jetbrains.kotlin.defaultErrorMessages");
|
||||
|
||||
@NotNull
|
||||
DiagnosticFactoryToRendererMap getMap();
|
||||
}
|
||||
|
||||
private static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap("Default");
|
||||
private static final MappedExtensionProvider<Extension, List<DiagnosticFactoryToRendererMap>> RENDERER_MAPS = MappedExtensionProvider.create(
|
||||
Extension.EP_NAME,
|
||||
extensions -> {
|
||||
List<DiagnosticFactoryToRendererMap> result = new ArrayList<>(extensions.size() + 1);
|
||||
for (Extension extension : extensions) {
|
||||
result.add(extension.getMap());
|
||||
}
|
||||
result.add(MAP);
|
||||
return result;
|
||||
});
|
||||
private static final List<DiagnosticFactoryToRendererMap> RENDERER_MAPS =
|
||||
CollectionsKt.plus(
|
||||
Collections.singletonList(MAP),
|
||||
CollectionsKt.map(ServiceLoader.load(Extension.class, DefaultErrorMessages.class.getClassLoader()), Extension::getMap)
|
||||
);
|
||||
|
||||
@NotNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public static String render(@NotNull Diagnostic diagnostic) {
|
||||
for (DiagnosticFactoryToRendererMap map : RENDERER_MAPS.get()) {
|
||||
DiagnosticRenderer renderer = map.get(diagnostic.getFactory());
|
||||
if (renderer != null) {
|
||||
//noinspection unchecked
|
||||
return renderer.render(diagnostic);
|
||||
}
|
||||
DiagnosticRenderer renderer = getRendererForDiagnostic(diagnostic);
|
||||
if (renderer != null) {
|
||||
return renderer.render(diagnostic);
|
||||
}
|
||||
throw new IllegalArgumentException("Don't know how to render diagnostic of type " + diagnostic.getFactory().getName() +
|
||||
" with the following renderer maps: " + RENDERER_MAPS.get());
|
||||
return diagnostic.toString() + " (error: could not render message)";
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@Nullable
|
||||
public static DiagnosticRenderer getRendererForDiagnostic(@NotNull Diagnostic diagnostic) {
|
||||
for (DiagnosticFactoryToRendererMap map : RENDERER_MAPS.get()) {
|
||||
DiagnosticRenderer renderer = map.get(diagnostic.getFactory());
|
||||
|
||||
if (renderer != null) return renderer;
|
||||
}
|
||||
|
||||
return null;
|
||||
return AddToStdlibKt.firstNotNullResult(RENDERER_MAPS, map -> map.get(diagnostic.getFactory()));
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -888,9 +872,9 @@ public class DefaultErrorMessages {
|
||||
MAP.put(ILLEGAL_SUSPEND_FUNCTION_CALL, "Suspend function ''{0}'' should be called only from a coroutine or another suspend function", NAME);
|
||||
MAP.put(ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL, "Restricted suspending functions can only invoke member or extension suspending functions on their restricted coroutine scope");
|
||||
|
||||
MAP.put(PLUGIN_ERROR, "{0}: {1}", TO_STRING, TO_STRING);
|
||||
MAP.put(PLUGIN_WARNING, "{0}: {1}", TO_STRING, TO_STRING);
|
||||
MAP.put(PLUGIN_INFO, "{0}: {1}", TO_STRING, TO_STRING);
|
||||
MAP.put(PLUGIN_ERROR, "{0}", (d, c) -> d.getText());
|
||||
MAP.put(PLUGIN_WARNING, "{0}", (d, c) -> d.getText());
|
||||
MAP.put(PLUGIN_INFO, "{0}", (d, c) -> d.getText());
|
||||
|
||||
MAP.put(ERROR_IN_CONTRACT_DESCRIPTION, "Error in contract description: {0}", TO_STRING);
|
||||
MAP.put(CONTRACT_NOT_ALLOWED, "Contract is not allowed here");
|
||||
|
||||
@@ -22,10 +22,12 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
|
||||
|
||||
class CompilerDeserializationConfiguration(languageVersionSettings: LanguageVersionSettings) : DeserializationConfiguration {
|
||||
override val typeAliasesAllowed = languageVersionSettings.supportsFeature(LanguageFeature.TypeAliases)
|
||||
|
||||
override val skipMetadataVersionCheck = languageVersionSettings.getFlag(AnalysisFlag.skipMetadataVersionCheck)
|
||||
|
||||
override val skipPreReleaseCheck = skipMetadataVersionCheck || !languageVersionSettings.languageVersion.isStable
|
||||
|
||||
override val typeAliasesAllowed = languageVersionSettings.supportsFeature(LanguageFeature.TypeAliases)
|
||||
|
||||
override val isJvmPackageNameSupported = languageVersionSettings.supportsFeature(LanguageFeature.JvmPackageName)
|
||||
|
||||
override val returnsEffectAllowed: Boolean = languageVersionSettings.supportsFeature(LanguageFeature.ReturnsEffect)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.UnwrappedType
|
||||
import org.jetbrains.kotlin.types.WrappedTypeFactory
|
||||
|
||||
interface DeclarationReturnTypeSanitizer {
|
||||
fun sanitizeReturnType(
|
||||
inferred: UnwrappedType,
|
||||
wrappedTypeFactory: WrappedTypeFactory,
|
||||
trace: BindingTrace,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
): UnwrappedType
|
||||
|
||||
object Default : DeclarationReturnTypeSanitizer {
|
||||
override fun sanitizeReturnType(
|
||||
inferred: UnwrappedType,
|
||||
wrappedTypeFactory: WrappedTypeFactory,
|
||||
trace: BindingTrace,
|
||||
languageVersionSettings: LanguageVersionSettings
|
||||
) = inferred
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,7 @@ public class DescriptorResolver {
|
||||
private final WrappedTypeFactory wrappedTypeFactory;
|
||||
private final SyntheticResolveExtension syntheticResolveExtension;
|
||||
private final TypeApproximator typeApproximator;
|
||||
private final DeclarationReturnTypeSanitizer declarationReturnTypeSanitizer;
|
||||
|
||||
public DescriptorResolver(
|
||||
@NotNull AnnotationResolver annotationResolver,
|
||||
@@ -103,7 +104,8 @@ public class DescriptorResolver {
|
||||
@NotNull ModifiersChecker modifiersChecker,
|
||||
@NotNull WrappedTypeFactory wrappedTypeFactory,
|
||||
@NotNull Project project,
|
||||
TypeApproximator approximator
|
||||
@NotNull TypeApproximator approximator,
|
||||
@NotNull DeclarationReturnTypeSanitizer declarationReturnTypeSanitizer
|
||||
) {
|
||||
this.annotationResolver = annotationResolver;
|
||||
this.builtIns = builtIns;
|
||||
@@ -120,6 +122,7 @@ public class DescriptorResolver {
|
||||
this.wrappedTypeFactory = wrappedTypeFactory;
|
||||
this.syntheticResolveExtension = SyntheticResolveExtension.Companion.getInstance(project);
|
||||
typeApproximator = approximator;
|
||||
this.declarationReturnTypeSanitizer = declarationReturnTypeSanitizer;
|
||||
}
|
||||
|
||||
public List<KotlinType> resolveSupertypes(
|
||||
@@ -1152,12 +1155,12 @@ public class DescriptorResolver {
|
||||
) {
|
||||
return wrappedTypeFactory.createRecursionIntolerantDeferredType(trace, () -> {
|
||||
PreliminaryDeclarationVisitor.Companion.createForDeclaration(function, trace, languageVersionSettings);
|
||||
KotlinType type = expressionTypingServices.getBodyExpressionType(
|
||||
trace, scope, dataFlowInfo, function, functionDescriptor);
|
||||
KotlinType result = transformAnonymousTypeIfNeeded(functionDescriptor, function, type, trace);
|
||||
UnwrappedType approximatedType = typeApproximator.approximateDeclarationType(result, false);
|
||||
functionsTypingVisitor.checkTypesForReturnStatements(function, trace, approximatedType);
|
||||
return approximatedType;
|
||||
KotlinType type = expressionTypingServices.getBodyExpressionType(trace, scope, dataFlowInfo, function, functionDescriptor);
|
||||
KotlinType publicType = transformAnonymousTypeIfNeeded(functionDescriptor, function, type, trace);
|
||||
UnwrappedType approximatedType = typeApproximator.approximateDeclarationType(publicType, false);
|
||||
KotlinType sanitizedType = declarationReturnTypeSanitizer.sanitizeReturnType(approximatedType, wrappedTypeFactory, trace, languageVersionSettings);
|
||||
functionsTypingVisitor.checkTypesForReturnStatements(function, trace, sanitizedType);
|
||||
return sanitizedType;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class FunctionDescriptorResolver(
|
||||
assert(function.typeReference == null) {
|
||||
"Return type must be initialized early for function: " + function.text + ", at: " + DiagnosticUtils.atLocation(function) }
|
||||
|
||||
val returnType = when {
|
||||
val inferredReturnType = when {
|
||||
function.hasBlockBody() ->
|
||||
builtIns.unitType
|
||||
function.hasBody() ->
|
||||
@@ -142,7 +142,7 @@ class FunctionDescriptorResolver(
|
||||
else ->
|
||||
ErrorUtils.createErrorType("No type, no body")
|
||||
}
|
||||
functionDescriptor.setReturnType(returnType)
|
||||
functionDescriptor.setReturnType(inferredReturnType)
|
||||
}
|
||||
|
||||
fun initializeFunctionDescriptorAndExplicitReturnType(
|
||||
|
||||
@@ -24,7 +24,7 @@ interface IdentifierChecker {
|
||||
fun checkIdentifier(identifier: PsiElement?, diagnosticHolder: DiagnosticSink)
|
||||
fun checkDeclaration(declaration: KtDeclaration, diagnosticHolder: DiagnosticSink)
|
||||
|
||||
object DEFAULT : IdentifierChecker {
|
||||
object Default : IdentifierChecker {
|
||||
override fun checkIdentifier(identifier: PsiElement?, diagnosticHolder: DiagnosticSink) {}
|
||||
override fun checkDeclaration(declaration: KtDeclaration, diagnosticHolder: DiagnosticSink) {}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,16 @@ import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.VariableDescriptorWithInitializerImpl
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.psi.KtPsiUtil
|
||||
import org.jetbrains.kotlin.psi.KtVariableDeclaration
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptorNonRoot
|
||||
interface OverloadFilter {
|
||||
fun filterPackageMemberOverloads(overloads: Collection<DeclarationDescriptorNonRoot>): Collection<DeclarationDescriptorNonRoot>
|
||||
|
||||
object DEFAULT : OverloadFilter {
|
||||
object Default : OverloadFilter {
|
||||
override fun filterPackageMemberOverloads(overloads: Collection<DeclarationDescriptorNonRoot>): Collection<DeclarationDescriptorNonRoot> =
|
||||
overloads
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
interface OverridesBackwardCompatibilityHelper {
|
||||
fun overrideCanBeOmitted(overridingDescriptor: CallableMemberDescriptor): Boolean
|
||||
|
||||
object DEFAULT : OverridesBackwardCompatibilityHelper {
|
||||
object Default : OverridesBackwardCompatibilityHelper {
|
||||
override fun overrideCanBeOmitted(overridingDescriptor: CallableMemberDescriptor): Boolean =
|
||||
false
|
||||
}
|
||||
|
||||
@@ -64,8 +64,9 @@ abstract class TargetPlatform(val platformName: String) {
|
||||
override val platformConfigurator =
|
||||
object : PlatformConfigurator(
|
||||
DynamicTypesSettings(), listOf(), listOf(), listOf(), listOf(), listOf(),
|
||||
IdentifierChecker.DEFAULT, OverloadFilter.DEFAULT, PlatformToKotlinClassMap.EMPTY, DelegationFilter.DEFAULT,
|
||||
OverridesBackwardCompatibilityHelper.DEFAULT
|
||||
IdentifierChecker.Default, OverloadFilter.Default, PlatformToKotlinClassMap.EMPTY, DelegationFilter.Default,
|
||||
OverridesBackwardCompatibilityHelper.Default,
|
||||
DeclarationReturnTypeSanitizer.Default
|
||||
) {
|
||||
override fun configureModuleComponents(container: StorageComponentContainer) {
|
||||
container.useInstance(SyntheticScopes.Empty)
|
||||
@@ -118,7 +119,8 @@ abstract class PlatformConfigurator(
|
||||
private val overloadFilter: OverloadFilter,
|
||||
private val platformToKotlinClassMap: PlatformToKotlinClassMap,
|
||||
private val delegationFilter: DelegationFilter,
|
||||
private val overridesBackwardCompatibilityHelper: OverridesBackwardCompatibilityHelper
|
||||
private val overridesBackwardCompatibilityHelper: OverridesBackwardCompatibilityHelper,
|
||||
private val declarationReturnTypeSanitizer: DeclarationReturnTypeSanitizer
|
||||
) {
|
||||
private val declarationCheckers: List<DeclarationChecker> = DEFAULT_DECLARATION_CHECKERS + additionalDeclarationCheckers
|
||||
private val callCheckers: List<CallChecker> = DEFAULT_CALL_CHECKERS + additionalCallCheckers
|
||||
@@ -139,6 +141,7 @@ abstract class PlatformConfigurator(
|
||||
useInstance(platformToKotlinClassMap)
|
||||
useInstance(delegationFilter)
|
||||
useInstance(overridesBackwardCompatibilityHelper)
|
||||
useInstance(declarationReturnTypeSanitizer)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
||||
import org.jetbrains.kotlin.descriptors.impl.VariableDescriptorWithInitializerImpl
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
@@ -39,7 +40,9 @@ class VariableTypeAndInitializerResolver(
|
||||
private val constantExpressionEvaluator: ConstantExpressionEvaluator,
|
||||
private val delegatedPropertyResolver: DelegatedPropertyResolver,
|
||||
private val wrappedTypeFactory: WrappedTypeFactory,
|
||||
private val typeApproximator: TypeApproximator
|
||||
private val typeApproximator: TypeApproximator,
|
||||
private val declarationReturnTypeSanitizer: DeclarationReturnTypeSanitizer,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
companion object {
|
||||
@JvmField
|
||||
@@ -92,6 +95,7 @@ class VariableTypeAndInitializerResolver(
|
||||
|
||||
else -> resolveInitializerType(scopeForInitializer, variable.initializer!!, dataFlowInfo, trace, local)
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
@@ -152,7 +156,9 @@ class VariableTypeAndInitializerResolver(
|
||||
trace: BindingTrace,
|
||||
local: Boolean
|
||||
): KotlinType {
|
||||
return approximateType(expressionTypingServices.safeGetType(scope, initializer, TypeUtils.NO_EXPECTED_TYPE, dataFlowInfo, trace), local)
|
||||
val inferredType = expressionTypingServices.safeGetType(scope, initializer, TypeUtils.NO_EXPECTED_TYPE, dataFlowInfo, trace)
|
||||
val approximatedType = approximateType(inferredType, local)
|
||||
return declarationReturnTypeSanitizer.sanitizeReturnType(approximatedType, wrappedTypeFactory, trace, languageVersionSettings)
|
||||
}
|
||||
|
||||
private fun approximateType(type: KotlinType, local: Boolean): UnwrappedType = typeApproximator.approximateDeclarationType(type, local)
|
||||
|
||||
@@ -180,12 +180,25 @@ class GenericCandidateResolver(
|
||||
|
||||
private fun getBinaryWithTypeParent(calleeExpression: KtExpression?): KtBinaryExpressionWithTypeRHS? {
|
||||
val callExpression = calleeExpression?.parent.safeAs<KtCallExpression>() ?: return null
|
||||
val parent = callExpression.parent
|
||||
return when (parent) {
|
||||
is KtBinaryExpressionWithTypeRHS -> parent
|
||||
is KtQualifiedExpression -> parent.parent.safeAs<KtBinaryExpressionWithTypeRHS>().takeIf { parent.selectorExpression == callExpression }
|
||||
else -> null
|
||||
val possibleQualifiedExpression = callExpression.parent
|
||||
|
||||
val targetExpression = if (possibleQualifiedExpression is KtQualifiedExpression) {
|
||||
if (possibleQualifiedExpression.selectorExpression != callExpression) return null
|
||||
possibleQualifiedExpression
|
||||
}
|
||||
else {
|
||||
callExpression
|
||||
}
|
||||
|
||||
return targetExpression.topParenthesizedParentOrMe().parent.safeAs<KtBinaryExpressionWithTypeRHS>()
|
||||
}
|
||||
|
||||
private fun KtExpression.topParenthesizedParentOrMe(): KtExpression {
|
||||
var result: KtExpression = this
|
||||
while (KtPsiUtil.deparenthesizeOnce(result.parent.safeAs()) == result) {
|
||||
result = result.parent.safeAs() ?: break
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
private fun addValidityConstraintsForConstituentTypes(builder: ConstraintSystem.Builder, type: KotlinType) {
|
||||
|
||||
@@ -96,9 +96,12 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
nullability: Nullability,
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
typeInfo: SetMultimap<DataFlowValue, KotlinType>? = null,
|
||||
affectReceiver: Boolean = true
|
||||
affectReceiver: Boolean = true,
|
||||
recordUnstable: Boolean = true
|
||||
): Boolean {
|
||||
map.put(value, nullability)
|
||||
if (value.isStable || recordUnstable) {
|
||||
map.put(value, nullability)
|
||||
}
|
||||
|
||||
val identifierInfo = value.identifierInfo
|
||||
if (affectReceiver && !nullability.canBeNull() &&
|
||||
@@ -108,7 +111,8 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
val receiverType = identifierInfo.receiverType
|
||||
if (identifierInfo.safe && receiverType != null) {
|
||||
val receiverValue = DataFlowValue(identifierInfo.receiverInfo, receiverType)
|
||||
putNullabilityAndTypeInfo(map, receiverValue, nullability, languageVersionSettings, typeInfo)
|
||||
putNullabilityAndTypeInfo(map, receiverValue, nullability,
|
||||
languageVersionSettings, typeInfo, recordUnstable = recordUnstable)
|
||||
}
|
||||
}
|
||||
is IdentifierInfo.SafeCast -> {
|
||||
@@ -118,12 +122,16 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.SafeCastCheckBoundSmartCasts)) {
|
||||
|
||||
val subjectValue = DataFlowValue(identifierInfo.subjectInfo, subjectType)
|
||||
putNullabilityAndTypeInfo(map, subjectValue, nullability, languageVersionSettings, typeInfo)
|
||||
typeInfo?.put(subjectValue, targetType)
|
||||
putNullabilityAndTypeInfo(map, subjectValue, nullability,
|
||||
languageVersionSettings, typeInfo, recordUnstable = false)
|
||||
if (subjectValue.isStable) {
|
||||
typeInfo?.put(subjectValue, targetType)
|
||||
}
|
||||
}
|
||||
}
|
||||
is IdentifierInfo.Variable -> identifierInfo.bound?.let {
|
||||
putNullabilityAndTypeInfo(map, it, nullability, languageVersionSettings, typeInfo)
|
||||
putNullabilityAndTypeInfo(map, it, nullability,
|
||||
languageVersionSettings, typeInfo, recordUnstable = recordUnstable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ interface DelegationFilter {
|
||||
|
||||
fun filter(interfaceMember: CallableMemberDescriptor, languageVersionSettings: LanguageVersionSettings): Boolean
|
||||
|
||||
object DEFAULT : DelegationFilter {
|
||||
object Default : DelegationFilter {
|
||||
override fun filter(interfaceMember: CallableMemberDescriptor, languageVersionSettings: LanguageVersionSettings) = true
|
||||
}
|
||||
}
|
||||
@@ -55,12 +55,7 @@ class FileScopeFactory(
|
||||
|
||||
fun createScopesForFile(file: KtFile, existingImports: ImportingScope? = null): FileScopes {
|
||||
val packageView = moduleDescriptor.getPackage(file.packageFqName)
|
||||
val packageFragment = topLevelDescriptorProvider.getPackageFragment(file.packageFqName)
|
||||
if (packageFragment == null) {
|
||||
// TODO J2K and change return type of diagnoseMissingPackageFragment() to Nothing
|
||||
(topLevelDescriptorProvider as? LazyClassContext)?.declarationProviderFactory?.diagnoseMissingPackageFragment(file)
|
||||
error("Could not find fragment ${file.packageFqName} for file ${file.name}")
|
||||
}
|
||||
val packageFragment = topLevelDescriptorProvider.getPackageFragmentOrDiagnoseFailure(file.packageFqName, file)
|
||||
|
||||
return FilesScopesBuilder(file, existingImports, packageFragment, packageView).result
|
||||
}
|
||||
@@ -119,7 +114,7 @@ class FileScopeFactory(
|
||||
}
|
||||
}
|
||||
|
||||
val lexicalScope = LexicalScope.Base(lazyImportingScope, topLevelDescriptorProvider.getPackageFragment(file.packageFqName)!!)
|
||||
val lexicalScope = LexicalScope.Base(lazyImportingScope, topLevelDescriptorProvider.getPackageFragmentOrDiagnoseFailure(file.packageFqName, file))
|
||||
|
||||
val importResolver = object : ImportResolver {
|
||||
override fun forceResolveAllImports() {
|
||||
|
||||
@@ -216,16 +216,8 @@ open class LazyDeclarationResolver @Deprecated("") constructor(
|
||||
val ktFile = declaration.containingFile as KtFile
|
||||
val fqName = ktFile.packageFqName
|
||||
topLevelDescriptorProvider.assertValid()
|
||||
val packageDescriptor = topLevelDescriptorProvider.getPackageFragment(fqName)
|
||||
if (packageDescriptor == null) {
|
||||
if (topLevelDescriptorProvider is LazyClassContext) {
|
||||
topLevelDescriptorProvider.declarationProviderFactory.diagnoseMissingPackageFragment(ktFile)
|
||||
}
|
||||
else {
|
||||
throw IllegalStateException("Cannot find package fragment for file " + ktFile.name + " with package " + fqName)
|
||||
}
|
||||
}
|
||||
return packageDescriptor!!.getMemberScope()
|
||||
val packageDescriptor = topLevelDescriptorProvider.getPackageFragmentOrDiagnoseFailure(fqName, ktFile)
|
||||
return packageDescriptor.getMemberScope()
|
||||
}
|
||||
else {
|
||||
return when (parentDeclaration) {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
|
||||
|
||||
@Inject
|
||||
public void setDelegationFilter(@NotNull DelegationFilter delegationFilter) {
|
||||
public void setDelegationFilter(@NotNull DelegationFilter delegationFilter) {
|
||||
this.delegationFilter = delegationFilter;
|
||||
}
|
||||
|
||||
@@ -213,6 +213,19 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
return packages.invoke(fqName);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LazyPackageDescriptor getPackageFragmentOrDiagnoseFailure(@NotNull FqName fqName, KtFile from) {
|
||||
|
||||
LazyPackageDescriptor packageDescriptor = getPackageFragment(fqName);
|
||||
if (packageDescriptor == null) {
|
||||
declarationProviderFactory.diagnoseMissingPackageFragment(fqName, from);
|
||||
assert false : "diagnoseMissingPackageFragment should throw!";
|
||||
}
|
||||
return packageDescriptor;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private LazyPackageDescriptor createPackage(FqName fqName) {
|
||||
PackageMemberDeclarationProvider provider = declarationProviderFactory.getPackageMemberDeclarationProvider(fqName);
|
||||
@@ -350,8 +363,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
) {
|
||||
result.add(current);
|
||||
for (FqName subPackage : packageFragmentProvider.getSubPackagesOf(current.getFqName(), MemberScope.Companion.getALL_NAME_FILTER())) {
|
||||
LazyPackageDescriptor fragment = getPackageFragment(subPackage);
|
||||
assert fragment != null : "Couldn't find fragment for " + subPackage;
|
||||
LazyPackageDescriptor fragment = getPackageFragmentOrDiagnoseFailure(subPackage, null);
|
||||
collectAllPackages(result, fragment);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -19,11 +19,14 @@ package org.jetbrains.kotlin.resolve.lazy
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor
|
||||
|
||||
interface TopLevelDescriptorProvider {
|
||||
fun getPackageFragment(fqName: FqName): LazyPackageDescriptor?
|
||||
|
||||
fun getPackageFragmentOrDiagnoseFailure(fqName: FqName, from: KtFile?): LazyPackageDescriptor
|
||||
|
||||
fun getTopLevelClassifierDescriptors(fqName: FqName, location: LookupLocation): Collection<ClassifierDescriptor>
|
||||
|
||||
fun assertValid()
|
||||
@@ -36,6 +39,10 @@ object NoTopLevelDescriptorProvider : TopLevelDescriptorProvider {
|
||||
shouldNotBeCalled()
|
||||
}
|
||||
|
||||
override fun getPackageFragmentOrDiagnoseFailure(fqName: FqName, from: KtFile?): LazyPackageDescriptor {
|
||||
shouldNotBeCalled()
|
||||
}
|
||||
|
||||
override fun getTopLevelClassifierDescriptors(fqName: FqName, location: LookupLocation): Collection<ClassifierDescriptor> {
|
||||
shouldNotBeCalled()
|
||||
}
|
||||
|
||||
@@ -40,7 +40,11 @@ public abstract class AbstractDeclarationProviderFactory implements DeclarationP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void diagnoseMissingPackageFragment(KtFile file) {
|
||||
throw new IllegalStateException("Cannot find package fragment for file " + file.getName() + " with package " + file.getPackageFqName());
|
||||
public void diagnoseMissingPackageFragment(@NotNull FqName fqName, @Nullable KtFile file) {
|
||||
String message = "Cannot find package fragment " + fqName;
|
||||
if (file != null) {
|
||||
message += "\nvFile = " + file.getVirtualFilePath() + ", file package = '" + file.getPackageFqName() + "'";
|
||||
}
|
||||
throw new IllegalStateException(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,5 +34,5 @@ public interface DeclarationProviderFactory {
|
||||
@Nullable
|
||||
PackageMemberDeclarationProvider getPackageMemberDeclarationProvider(@NotNull FqName packageFqName);
|
||||
|
||||
void diagnoseMissingPackageFragment(KtFile file);
|
||||
void diagnoseMissingPackageFragment(@NotNull FqName fqName, @Nullable KtFile file);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ class LocalClassDescriptorHolder(
|
||||
throw UnsupportedOperationException("Should not be called for top-level declarations")
|
||||
}
|
||||
|
||||
override fun diagnoseMissingPackageFragment(file: KtFile?) {
|
||||
override fun diagnoseMissingPackageFragment(fqName: FqName, file: KtFile?) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,15 +46,10 @@ protected constructor(
|
||||
cached = WeakReference(newVal)
|
||||
return newVal.second
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic fun <T, R> create(epName: ExtensionPointName<T>, map: (List<T>) -> R): MappedExtensionProvider<T, R>
|
||||
= MappedExtensionProvider(epName, map)
|
||||
}
|
||||
}
|
||||
|
||||
class ExtensionProvider<T>(epName: ExtensionPointName<T>) : MappedExtensionProvider<T, List<T>>(epName, { it }) {
|
||||
companion object {
|
||||
@JvmStatic fun <T> create(epName: ExtensionPointName<T>): ExtensionProvider<T> = ExtensionProvider(epName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.incremental
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.build.GeneratedFile
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.config.Services
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
@@ -83,6 +83,16 @@ class IncrementalJsCompilerRunner(
|
||||
override fun calculateSourcesToCompile(caches: IncrementalJsCachesManager, changedFiles: ChangedFiles.Known, args: K2JSCompilerArguments): CompilationMode {
|
||||
if (BuildInfo.read(lastBuildInfoFile) == null) return CompilationMode.Rebuild { "No information on previous build" }
|
||||
|
||||
val libs = (args.libraries ?: "").split(File.pathSeparator).mapTo(HashSet()) { File(it) }
|
||||
val libsDirs = libs.filter { it.isDirectory }
|
||||
|
||||
val changedLib = changedFiles.allAsSequence.find { it in libs }
|
||||
?: changedFiles.allAsSequence.find { changedFile ->
|
||||
libsDirs.any { libDir -> FileUtil.isAncestor(libDir, changedFile, true) }
|
||||
}
|
||||
|
||||
if (changedLib != null) return CompilationMode.Rebuild { "Library has been changed: $changedLib" }
|
||||
|
||||
return CompilationMode.Incremental(getDirtyFiles(changedFiles))
|
||||
}
|
||||
|
||||
@@ -133,4 +143,7 @@ class IncrementalJsCompilerRunner(
|
||||
args.freeArgs = freeArgsBackup
|
||||
}
|
||||
}
|
||||
|
||||
private val ChangedFiles.Known.allAsSequence: Sequence<File>
|
||||
get() = modified.asSequence() + removed.asSequence()
|
||||
}
|
||||
6
compiler/testData/cli/jvm/extraHelp.out
vendored
6
compiler/testData/cli/jvm/extraHelp.out
vendored
@@ -5,8 +5,8 @@ where advanced options include:
|
||||
or all modules on the module path if <module> is ALL-MODULE-PATH
|
||||
-Xbuild-file=<path> Path to the .xml build file to compile
|
||||
-Xcompile-java Reuse javac analysis and compile Java source files
|
||||
-Xnormalize-constructor-calls={disable|enable|preserve-class-initialization}
|
||||
Normalize constructor calls (disable: don't normalize; enable: normalize; preserve-class-initialization: normalize preserving class initialization order), default is disable
|
||||
-Xnormalize-constructor-calls={disable|enable}
|
||||
Normalize constructor calls (disable: don't normalize; enable: normalize), default is disable
|
||||
-Xdump-declarations-to=<path> Path to JSON file to dump Java to Kotlin declaration mappings
|
||||
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
|
||||
-Xmodule-path=<path> Paths where to find Java 9+ modules
|
||||
@@ -26,6 +26,8 @@ where advanced options include:
|
||||
Script resolver environment in key-value pairs (the value could be quoted and escaped)
|
||||
-Xsingle-module Combine modules for source files and binary dependencies into a single module
|
||||
-Xskip-runtime-version-check Allow Kotlin runtime libraries of incompatible versions in the classpath
|
||||
-Xstrict-java-nullability-assertions
|
||||
Generate nullability assertions for non-null Java expressions
|
||||
-Xuse-javac Use javac for Java source and class files analysis
|
||||
-Xuse-old-class-files-reading Use old class files reading implementation (may slow down the build and should be used in case of problems with the new implementation)
|
||||
-Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info
|
||||
|
||||
24
compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor1.kt
vendored
Normal file
24
compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor1.kt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
interface IFoo {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
interface IBar {
|
||||
fun bar(): String
|
||||
}
|
||||
|
||||
abstract class Base(val x: IFoo)
|
||||
|
||||
enum class Test : IFoo, IBar {
|
||||
FOO {
|
||||
// FOO referenced from inner class constructor with uninitialized 'this'
|
||||
inner class Inner : Base(FOO)
|
||||
|
||||
val z = Inner()
|
||||
|
||||
override fun foo() = "OK"
|
||||
|
||||
override fun bar() = z.x.foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = Test.FOO.bar()
|
||||
24
compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor2.kt
vendored
Normal file
24
compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor2.kt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
interface IFoo {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
interface IBar {
|
||||
fun bar(): String
|
||||
}
|
||||
|
||||
enum class Test : IFoo, IBar {
|
||||
FOO {
|
||||
// FOO referenced from inner class constructor with initialized 'this'
|
||||
inner class Inner {
|
||||
val fooFoo = FOO.foo()
|
||||
}
|
||||
|
||||
val z = Inner()
|
||||
|
||||
override fun foo() = "OK"
|
||||
|
||||
override fun bar() = z.fooFoo
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = Test.FOO.bar()
|
||||
23
compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor3.kt
vendored
Normal file
23
compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor3.kt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
interface IFoo {
|
||||
fun foo(): String
|
||||
}
|
||||
|
||||
interface IBar {
|
||||
fun bar(): String
|
||||
}
|
||||
|
||||
enum class Test : IFoo, IBar {
|
||||
FOO {
|
||||
// FOO referenced from inner class constructor with initialized 'this',
|
||||
// in delegate initializer
|
||||
inner class Inner : IFoo by FOO
|
||||
|
||||
val z = Inner()
|
||||
|
||||
override fun foo() = "OK"
|
||||
|
||||
override fun bar() = z.foo()
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = Test.FOO.bar()
|
||||
8
compiler/testData/codegen/box/enum/kt20651a.kt
vendored
Normal file
8
compiler/testData/codegen/box/enum/kt20651a.kt
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
enum class Foo(
|
||||
val x: String,
|
||||
val callback: () -> String
|
||||
) {
|
||||
FOO("OK", { FOO.x })
|
||||
}
|
||||
|
||||
fun box() = Foo.FOO.callback()
|
||||
17
compiler/testData/codegen/box/enum/kt20651b.kt
vendored
Normal file
17
compiler/testData/codegen/box/enum/kt20651b.kt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
interface Callback {
|
||||
fun invoke(): String
|
||||
}
|
||||
|
||||
enum class Foo(
|
||||
val x: String,
|
||||
val callback: Callback
|
||||
) {
|
||||
FOO(
|
||||
"OK",
|
||||
object : Callback {
|
||||
override fun invoke() = FOO.x
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun box() = Foo.FOO.callback.invoke()
|
||||
@@ -0,0 +1,29 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "Fail: should throw"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun withAssertion(j: J) = j.nullString()
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public @NotNull String nullString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
TestKt.withAssertion(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// See KT-8135
|
||||
// We could generate runtime assertion on call site for 'generic<NOT_NULL_TYPE>()' below.
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "OK"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "Fail: SHOULD NOT throw"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun withAssertion(j: J) = generic<String?>(j)
|
||||
|
||||
fun <T> generic(j: J) = j.nullT<T>()
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public <T> @NotNull T nullT() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
TestKt.withAssertion(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
outer()
|
||||
return "Fail: should throw"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun outer() {
|
||||
fun withAssertion() = J().nullString()
|
||||
withAssertion() // NB not used itself
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public @NotNull String nullString() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "Fail: should throw"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
fun withAssertion(j: J) {
|
||||
val x = j.nullString()
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public @NotNull String nullString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
TestKt.withAssertion(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "Fail: should throw"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
class C {
|
||||
val withAssertion = J().nullString()
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public @NotNull String nullString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object test() {
|
||||
return new C();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "Fail: should throw"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
val withAssertion get() = J().nullString()
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public @NotNull String nullString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
TestKt.getWithAssertion();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// STRICT_JAVA_NULLABILITY_ASSERTIONS
|
||||
|
||||
// FILE: box.kt
|
||||
fun box(): String {
|
||||
try {
|
||||
J().test()
|
||||
return "Fail: should throw"
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
val withAssertion = J().nullString()
|
||||
|
||||
fun clinitTrigger() {}
|
||||
|
||||
// FILE: J.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class J {
|
||||
public @NotNull String nullString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
TestKt.clinitTrigger();
|
||||
}
|
||||
}
|
||||
39
compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/emptyLhs.kt
vendored
Normal file
39
compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/emptyLhs.kt
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
lateinit var p: String
|
||||
|
||||
fun test(): Boolean {
|
||||
if (!::p.isInitialized) {
|
||||
p = "OK"
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
object Bar {
|
||||
lateinit var p: String
|
||||
|
||||
fun test(): Boolean {
|
||||
if (!::p.isInitialized) {
|
||||
p = "OK"
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
if (foo.test()) return "Fail 1"
|
||||
if (!foo.test()) return "Fail 2"
|
||||
|
||||
val bar = Bar
|
||||
if (bar.test()) return "Fail 3"
|
||||
if (!bar.test()) return "Fail 4"
|
||||
|
||||
return bar.p
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
package test
|
||||
|
||||
import test.Derived.p
|
||||
|
||||
open class Base(val b: Boolean)
|
||||
|
||||
object Derived : Base(::p.isInitialized) {
|
||||
lateinit var p: String
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return if (Derived.b) "Fail" else "OK"
|
||||
}
|
||||
23
compiler/testData/codegen/box/ranges/contains/comparisonWithRangeBoundEliminated.kt
vendored
Normal file
23
compiler/testData/codegen/box/ranges/contains/comparisonWithRangeBoundEliminated.kt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
fun abs(x: Int) = if (x < 0) -x else x
|
||||
fun abs(x: Long) = if (x < 0) -x else x
|
||||
|
||||
fun test1() =
|
||||
5 in abs(-1) .. 10
|
||||
|
||||
fun test2() =
|
||||
5 in 1 .. abs(-10)
|
||||
|
||||
fun test3() =
|
||||
5L in abs(-1L) .. 10L
|
||||
|
||||
fun test4() =
|
||||
5L in 1L .. abs(-10L)
|
||||
|
||||
fun box(): String {
|
||||
if (!test1()) return "Fail 1"
|
||||
if (!test2()) return "Fail 2"
|
||||
if (!test3()) return "Fail 3"
|
||||
if (!test4()) return "Fail 4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
9
compiler/testData/diagnostics/tests/enum/wrongUnitializedEnumCompanion.kt
vendored
Normal file
9
compiler/testData/diagnostics/tests/enum/wrongUnitializedEnumCompanion.kt
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// See KT-20959
|
||||
|
||||
enum class Foo {;
|
||||
companion object {
|
||||
val x = <!DEBUG_INFO_LEAKING_THIS!>foo<!>() // there should be no UNINITIALIZED_ENUM_COMPANION
|
||||
|
||||
private fun foo() = "OK"
|
||||
}
|
||||
}
|
||||
27
compiler/testData/diagnostics/tests/enum/wrongUnitializedEnumCompanion.txt
vendored
Normal file
27
compiler/testData/diagnostics/tests/enum/wrongUnitializedEnumCompanion.txt
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
package
|
||||
|
||||
public final enum class Foo : kotlin.Enum<Foo> {
|
||||
private constructor Foo()
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: Foo): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<Foo!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
public final val x: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
private final fun foo(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): Foo
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<Foo>
|
||||
}
|
||||
21
compiler/testData/diagnostics/tests/inference/expectedTypeFromCastParenthesized.kt
vendored
Normal file
21
compiler/testData/diagnostics/tests/inference/expectedTypeFromCastParenthesized.kt
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +ExpectedTypeFromCast
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
annotation class bar
|
||||
|
||||
fun <T> foo(): T = TODO()
|
||||
|
||||
fun <V> id(value: V) = value
|
||||
|
||||
val par1 = (foo()) as String
|
||||
val par2 = ((foo())) as String
|
||||
|
||||
val par3 = (dd@ (foo())) as String
|
||||
|
||||
val par4 = ( @bar() (foo())) as String
|
||||
|
||||
object X {
|
||||
fun <T> foo(): T = TODO()
|
||||
}
|
||||
|
||||
val par5 = ( @bar() X.foo()) as String
|
||||
24
compiler/testData/diagnostics/tests/inference/expectedTypeFromCastParenthesized.txt
vendored
Normal file
24
compiler/testData/diagnostics/tests/inference/expectedTypeFromCastParenthesized.txt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public val par1: kotlin.String
|
||||
public val par2: kotlin.String
|
||||
public val par3: kotlin.String
|
||||
public val par4: kotlin.String
|
||||
public val par5: kotlin.String
|
||||
public fun </*0*/ T> foo(): T
|
||||
public fun </*0*/ V> id(/*0*/ value: V): V
|
||||
|
||||
public object X {
|
||||
private constructor X()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun </*0*/ T> foo(): T
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.EXPRESSION}) public final annotation class bar : kotlin.Annotation {
|
||||
public constructor bar()
|
||||
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
|
||||
}
|
||||
19
compiler/testData/diagnostics/tests/j+k/annotationsInheritance.kt
vendored
Normal file
19
compiler/testData/diagnostics/tests/j+k/annotationsInheritance.kt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// FILE: MyAnnotation.java
|
||||
public @interface MyAnnotation {
|
||||
}
|
||||
// FILE: MyAnnoClass.java
|
||||
public class MyAnnoClass implements MyAnnotation {
|
||||
//...
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
val ann: MyAnnotation = MyAnnoClass()
|
||||
|
||||
fun foo(x: MyAnnoClass) {
|
||||
bar(x)
|
||||
}
|
||||
|
||||
fun bar(y: MyAnnotation) {
|
||||
y.hashCode()
|
||||
}
|
||||
19
compiler/testData/diagnostics/tests/j+k/annotationsInheritance.txt
vendored
Normal file
19
compiler/testData/diagnostics/tests/j+k/annotationsInheritance.txt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public val ann: MyAnnotation
|
||||
public fun bar(/*0*/ y: MyAnnotation): kotlin.Unit
|
||||
public fun foo(/*0*/ x: MyAnnoClass): kotlin.Unit
|
||||
|
||||
public open class MyAnnoClass : MyAnnotation {
|
||||
public constructor MyAnnoClass()
|
||||
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
|
||||
}
|
||||
|
||||
public final annotation class MyAnnotation : kotlin.Annotation {
|
||||
public constructor MyAnnotation()
|
||||
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
|
||||
}
|
||||
25
compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.kt
vendored
Normal file
25
compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.kt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: +SafeCastCheckBoundSmartCasts
|
||||
// See KT-20752
|
||||
|
||||
class Unstable {
|
||||
val first: String? get() = null
|
||||
}
|
||||
|
||||
class StringList {
|
||||
fun remove(s: String) = s
|
||||
}
|
||||
|
||||
fun StringList.remove(s: String?) = s ?: ""
|
||||
|
||||
fun foo(list: StringList, arg: Unstable) {
|
||||
list.remove(arg.first)
|
||||
if (arg.first <!USELESS_CAST!>as? String<!> != null) {
|
||||
// Ideally should have smart cast impossible here
|
||||
list.remove(arg.first)
|
||||
}
|
||||
val s = arg.first <!USELESS_CAST!>as? String<!>
|
||||
if (s != null) {
|
||||
// Ideally should have smart cast impossible here
|
||||
list.remove(arg.first)
|
||||
}
|
||||
}
|
||||
20
compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.txt
vendored
Normal file
20
compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.txt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ list: StringList, /*1*/ arg: Unstable): kotlin.Unit
|
||||
public fun StringList.remove(/*0*/ s: kotlin.String?): kotlin.String
|
||||
|
||||
public final class StringList {
|
||||
public constructor StringList()
|
||||
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 final fun remove(/*0*/ s: kotlin.String): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Unstable {
|
||||
public constructor Unstable()
|
||||
public final val first: 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
|
||||
}
|
||||
40
compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt
vendored
Normal file
40
compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// !LANGUAGE: +BooleanElvisBoundSmartCasts
|
||||
// See KT-20752
|
||||
|
||||
class Unstable {
|
||||
val first: String? get() = null
|
||||
}
|
||||
|
||||
class StringList {
|
||||
fun remove(s: String) = s
|
||||
}
|
||||
|
||||
fun StringList.remove(s: String?) = s ?: ""
|
||||
|
||||
fun String.isEmpty() = this == ""
|
||||
|
||||
fun foo(list: StringList, arg: Unstable) {
|
||||
list.remove(arg.first)
|
||||
if (arg.first?.isEmpty() ?: false) {
|
||||
// Ideally should have smart cast impossible here
|
||||
list.remove(<!SMARTCAST_IMPOSSIBLE!>arg.first<!>)
|
||||
}
|
||||
}
|
||||
|
||||
class UnstableBoolean {
|
||||
val first: Boolean? get() = null
|
||||
}
|
||||
|
||||
class BooleanList {
|
||||
fun remove(b: Boolean) = b
|
||||
}
|
||||
|
||||
fun BooleanList.remove(b: Boolean?) = b ?: false
|
||||
|
||||
fun bar(list: BooleanList, arg: UnstableBoolean) {
|
||||
list.remove(arg.first)
|
||||
if (arg.first ?: false) {
|
||||
// Ideally should have smart cast impossible here
|
||||
list.remove(<!SMARTCAST_IMPOSSIBLE!>arg.first<!>)
|
||||
}
|
||||
}
|
||||
39
compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.txt
vendored
Normal file
39
compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.txt
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ list: BooleanList, /*1*/ arg: UnstableBoolean): kotlin.Unit
|
||||
public fun foo(/*0*/ list: StringList, /*1*/ arg: Unstable): kotlin.Unit
|
||||
public fun kotlin.String.isEmpty(): kotlin.Boolean
|
||||
public fun BooleanList.remove(/*0*/ b: kotlin.Boolean?): kotlin.Boolean
|
||||
public fun StringList.remove(/*0*/ s: kotlin.String?): kotlin.String
|
||||
|
||||
public final class BooleanList {
|
||||
public constructor BooleanList()
|
||||
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 final fun remove(/*0*/ b: kotlin.Boolean): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class StringList {
|
||||
public constructor StringList()
|
||||
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 final fun remove(/*0*/ s: kotlin.String): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Unstable {
|
||||
public constructor Unstable()
|
||||
public final val first: 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
|
||||
}
|
||||
|
||||
public final class UnstableBoolean {
|
||||
public constructor UnstableBoolean()
|
||||
public final val first: kotlin.Boolean?
|
||||
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
|
||||
}
|
||||
56
compiler/testData/diagnostics/testsWithJsStdLib/name/builtinClash.kt
vendored
Normal file
56
compiler/testData/diagnostics/testsWithJsStdLib/name/builtinClash.kt
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
class C {
|
||||
class <!JS_BUILTIN_NAME_CLASH!>prototype<!>
|
||||
|
||||
class <!JS_BUILTIN_NAME_CLASH!>length<!>
|
||||
|
||||
class <!JS_BUILTIN_NAME_CLASH!>`$metadata$`<!>
|
||||
|
||||
<!JS_BUILTIN_NAME_CLASH!>fun constructor()<!> {}
|
||||
}
|
||||
|
||||
class D {
|
||||
private class <!JS_BUILTIN_NAME_CLASH!>prototype<!>
|
||||
|
||||
private class <!JS_BUILTIN_NAME_CLASH!>length<!>
|
||||
|
||||
private class <!JS_BUILTIN_NAME_CLASH!>`$metadata$`<!>
|
||||
|
||||
private fun constructor() {}
|
||||
}
|
||||
|
||||
class E {
|
||||
@JsName("prototype")
|
||||
class <!JS_BUILTIN_NAME_CLASH!>D<!>
|
||||
|
||||
<!JS_BUILTIN_NAME_CLASH!>@JsName("constructor")
|
||||
fun f()<!> {}
|
||||
}
|
||||
|
||||
class F {
|
||||
@JsName("A")
|
||||
class prototype
|
||||
|
||||
@JsName("B")
|
||||
class length
|
||||
|
||||
@JsName("f")
|
||||
fun constructor() {}
|
||||
}
|
||||
|
||||
class prototype
|
||||
|
||||
class length
|
||||
|
||||
fun constructor() {
|
||||
}
|
||||
|
||||
fun f() {
|
||||
class prototype
|
||||
class length
|
||||
|
||||
fun constructor() {}
|
||||
}
|
||||
|
||||
external interface Object {
|
||||
val constructor: Any?
|
||||
}
|
||||
120
compiler/testData/diagnostics/testsWithJsStdLib/name/builtinClash.txt
vendored
Normal file
120
compiler/testData/diagnostics/testsWithJsStdLib/name/builtinClash.txt
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
package
|
||||
|
||||
public fun constructor(): kotlin.Unit
|
||||
public fun f(): kotlin.Unit
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public final fun constructor(): kotlin.Unit
|
||||
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
|
||||
|
||||
public final class `$metadata$` {
|
||||
public constructor `$metadata$`()
|
||||
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
|
||||
}
|
||||
|
||||
public final class length {
|
||||
public constructor length()
|
||||
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
|
||||
}
|
||||
|
||||
public final class prototype {
|
||||
public constructor prototype()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public final class D {
|
||||
public constructor D()
|
||||
private final fun constructor(): kotlin.Unit
|
||||
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
|
||||
|
||||
private final class `$metadata$` {
|
||||
public constructor `$metadata$`()
|
||||
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
|
||||
}
|
||||
|
||||
private final class length {
|
||||
public constructor length()
|
||||
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
|
||||
}
|
||||
|
||||
private final class prototype {
|
||||
public constructor prototype()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public final class E {
|
||||
public constructor E()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@kotlin.js.JsName(name = "constructor") public final fun f(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@kotlin.js.JsName(name = "prototype") public final class D {
|
||||
public constructor D()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public final class F {
|
||||
public constructor F()
|
||||
@kotlin.js.JsName(name = "f") public final fun constructor(): kotlin.Unit
|
||||
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
|
||||
|
||||
@kotlin.js.JsName(name = "B") public final class length {
|
||||
public constructor length()
|
||||
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
|
||||
}
|
||||
|
||||
@kotlin.js.JsName(name = "A") public final class prototype {
|
||||
public constructor prototype()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
public external interface Object {
|
||||
public abstract val constructor: kotlin.Any?
|
||||
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
|
||||
}
|
||||
|
||||
public final class length {
|
||||
public constructor length()
|
||||
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
|
||||
}
|
||||
|
||||
public final class prototype {
|
||||
public constructor prototype()
|
||||
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
|
||||
}
|
||||
25
compiler/testData/diagnostics/testsWithJsStdLib/wrongMultipleInheritance.kt
vendored
Normal file
25
compiler/testData/diagnostics/testsWithJsStdLib/wrongMultipleInheritance.kt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
open class A {
|
||||
fun get(index: Int): Char = '*'
|
||||
}
|
||||
|
||||
abstract class <!WRONG_MULTIPLE_INHERITANCE!>B<!> : A(), CharSequence
|
||||
|
||||
interface I {
|
||||
fun nextChar(): Char
|
||||
}
|
||||
|
||||
abstract class <!WRONG_MULTIPLE_INHERITANCE!>C<!> : CharIterator(), I {
|
||||
override fun nextChar(): Char = '*'
|
||||
}
|
||||
|
||||
class <!WRONG_MULTIPLE_INHERITANCE!>CC(val s: CharSequence)<!> : CharSequence by s, MyCharSequence {}
|
||||
|
||||
interface MyCharSequence {
|
||||
val length: Int
|
||||
|
||||
operator fun get(index: Int): Char
|
||||
|
||||
fun subSequence(startIndex: Int, endIndex: Int): CharSequence
|
||||
}
|
||||
56
compiler/testData/diagnostics/testsWithJsStdLib/wrongMultipleInheritance.txt
vendored
Normal file
56
compiler/testData/diagnostics/testsWithJsStdLib/wrongMultipleInheritance.txt
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
package
|
||||
|
||||
public open class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun get(/*0*/ index: kotlin.Int): kotlin.Char
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class B : A, kotlin.CharSequence {
|
||||
public constructor B()
|
||||
public abstract override /*1*/ /*fake_override*/ val length: kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*2*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public abstract class C : kotlin.collections.CharIterator, I {
|
||||
public constructor C()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract override /*1*/ /*fake_override*/ fun hasNext(): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun next(): kotlin.Char
|
||||
public open override /*2*/ fun nextChar(): kotlin.Char
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CC : kotlin.CharSequence, MyCharSequence {
|
||||
public constructor CC(/*0*/ s: kotlin.CharSequence)
|
||||
public open override /*2*/ /*delegation*/ val length: kotlin.Int
|
||||
public final val s: kotlin.CharSequence
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*delegation*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*delegation*/ fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface I {
|
||||
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 abstract fun nextChar(): kotlin.Char
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface MyCharSequence {
|
||||
public abstract val length: kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract operator fun get(/*0*/ index: kotlin.Int): kotlin.Char
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
17
compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.kt
vendored
Normal file
17
compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.kt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// FILE: A.java
|
||||
import org.checkerframework.checker.nullness.qual.*;
|
||||
public class A {
|
||||
@NonNull
|
||||
public Object foo() { return null; }
|
||||
}
|
||||
// FILE: B.java
|
||||
public class B {
|
||||
public static void assertNonNull(Object x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun main() {
|
||||
A()
|
||||
B.assertNonNull(null)
|
||||
}
|
||||
21
compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.txt
vendored
Normal file
21
compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.txt
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public open class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@org.checkerframework.checker.nullness.qual.NonNull public open fun foo(): @org.checkerframework.checker.nullness.qual.NonNull kotlin.Any
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class B {
|
||||
public constructor B()
|
||||
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
|
||||
|
||||
// Static members
|
||||
public open fun assertNonNull(/*0*/ x: kotlin.Any!): kotlin.Unit
|
||||
}
|
||||
@@ -69,10 +69,7 @@ import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -163,6 +160,9 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
) {
|
||||
List<String> kotlinConfigurationFlags = new ArrayList<>(0);
|
||||
LanguageVersion explicitLanguageVersion = null;
|
||||
|
||||
boolean withStrictJavaNullabilityAssertions = false;
|
||||
|
||||
for (TestFile testFile : testFilesWithConfigurationDirectives) {
|
||||
kotlinConfigurationFlags.addAll(InTextDirectivesUtils.findListWithPrefixes(testFile.content, "// KOTLIN_CONFIGURATION_FLAGS:"));
|
||||
|
||||
@@ -179,13 +179,29 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
|
||||
assert explicitLanguageVersion == null : "Should not specify LANGUAGE_VERSION twice";
|
||||
explicitLanguageVersion = LanguageVersion.fromVersionString(version);
|
||||
}
|
||||
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(testFile.content, "// STRICT_JAVA_NULLABILITY_ASSERTIONS")) {
|
||||
withStrictJavaNullabilityAssertions = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (explicitLanguageVersion != null) {
|
||||
CommonConfigurationKeysKt.setLanguageVersionSettings(
|
||||
configuration,
|
||||
new LanguageVersionSettingsImpl(explicitLanguageVersion, ApiVersion.createByLanguageVersion(explicitLanguageVersion))
|
||||
if (explicitLanguageVersion != null || withStrictJavaNullabilityAssertions) {
|
||||
if (explicitLanguageVersion == null) {
|
||||
explicitLanguageVersion = LanguageVersion.LATEST_STABLE;
|
||||
}
|
||||
|
||||
HashMap<LanguageFeature, LanguageFeature.State> extraLanguageFeatures = new HashMap<>();
|
||||
if (withStrictJavaNullabilityAssertions) {
|
||||
extraLanguageFeatures.put(LanguageFeature.StrictJavaNullabilityAssertions, LanguageFeature.State.ENABLED);
|
||||
}
|
||||
|
||||
LanguageVersionSettingsImpl languageVersionSettings = new LanguageVersionSettingsImpl(
|
||||
explicitLanguageVersion,
|
||||
ApiVersion.createByLanguageVersion(explicitLanguageVersion),
|
||||
Collections.emptyMap(),
|
||||
extraLanguageFeatures
|
||||
);
|
||||
CommonConfigurationKeysKt.setLanguageVersionSettings(configuration, languageVersionSettings);
|
||||
}
|
||||
|
||||
updateConfigurationWithFlags(configuration, kotlinConfigurationFlags);
|
||||
|
||||
@@ -7934,6 +7934,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumEntryReferenceFromInnerClassConstructor1.kt")
|
||||
public void testEnumEntryReferenceFromInnerClassConstructor1() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor1.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumEntryReferenceFromInnerClassConstructor2.kt")
|
||||
public void testEnumEntryReferenceFromInnerClassConstructor2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumEntryReferenceFromInnerClassConstructor3.kt")
|
||||
public void testEnumEntryReferenceFromInnerClassConstructor3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumEntryReferenceFromInnerClassConstructor3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumInheritedFromTrait.kt")
|
||||
public void testEnumInheritedFromTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/enumInheritedFromTrait.kt");
|
||||
@@ -8012,6 +8030,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt20651a.kt")
|
||||
public void testKt20651a() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/kt20651a.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt20651b.kt")
|
||||
public void testKt20651b() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/kt20651b.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2350.kt")
|
||||
public void testKt2350() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/enum/kt2350.kt");
|
||||
@@ -10174,17 +10204,134 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt")
|
||||
public void testDestructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionReceiverParameter.kt")
|
||||
public void testExtensionReceiverParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiver_lv11.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiver_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiver_lv12.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mapPut.kt")
|
||||
public void testMapPut() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/mapPut.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnExtensionReceiver_lv11.kt")
|
||||
public void testNullabilityAssertionOnExtensionReceiver_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt")
|
||||
public void testNullabilityAssertionOnInlineFunExtensionReceiver_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnInlineFunExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnMemberExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnMemberExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnPrivateMemberExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class EnhancedNullability extends AbstractIrBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInEnhancedNullability() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inFunctionWithExpressionBody.kt")
|
||||
public void testInFunctionWithExpressionBody() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBody.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inFunctionWithExpressionBodyWithJavaGeneric.kt")
|
||||
public void testInFunctionWithExpressionBodyWithJavaGeneric() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inFunctionWithExpressionBodyWithJavaGeneric.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inLocalFunctionWithExpressionBody.kt")
|
||||
public void testInLocalFunctionWithExpressionBody() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalFunctionWithExpressionBody.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inLocalVariableInitializer.kt")
|
||||
public void testInLocalVariableInitializer() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalVariableInitializer.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inMemberPropertyInitializer.kt")
|
||||
public void testInMemberPropertyInitializer() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inMemberPropertyInitializer.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inPropertyGetterWithExpressionBody.kt")
|
||||
public void testInPropertyGetterWithExpressionBody() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inPropertyGetterWithExpressionBody.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inTopLevelPropertyInitializer.kt")
|
||||
public void testInTopLevelPropertyInitializer() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inTopLevelPropertyInitializer.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/javaInterop/objectMethods")
|
||||
@@ -11910,81 +12057,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/nullabilityAssertions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NullabilityAssertions extends AbstractIrBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInNullabilityAssertions() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/nullabilityAssertions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt")
|
||||
public void testDestructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiver_lv11.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiver_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incWithNullabilityAssertionOnExtensionReceiver_lv12.kt")
|
||||
public void testIncWithNullabilityAssertionOnExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnExtensionReceiver_lv11.kt")
|
||||
public void testNullabilityAssertionOnExtensionReceiver_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/nullabilityAssertionOnExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt")
|
||||
public void testNullabilityAssertionOnInlineFunExtensionReceiver_lv11() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv11.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnInlineFunExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/nullabilityAssertionOnInlineFunExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnMemberExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnMemberExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/nullabilityAssertionOnMemberExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt")
|
||||
public void testNullabilityAssertionOnPrivateMemberExtensionReceiver_lv12() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/nullabilityAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver_lv12.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/objectIntrinsics")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -13908,12 +13980,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("emptyLhs.kt")
|
||||
public void testEmptyLhs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/emptyLhs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("innerSubclass.kt")
|
||||
public void testInnerSubclass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyImportedFromObject.kt")
|
||||
public void testPropertyImportedFromObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/propertyImportedFromObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("sideEffects.kt")
|
||||
public void testSideEffects() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/sideEffects.kt");
|
||||
@@ -14110,6 +14194,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("comparisonWithRangeBoundEliminated.kt")
|
||||
public void testComparisonWithRangeBoundEliminated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/comparisonWithRangeBoundEliminated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("evaluationOrderForCollection.kt")
|
||||
public void testEvaluationOrderForCollection() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/evaluationOrderForCollection.kt");
|
||||
|
||||
@@ -48,6 +48,12 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathTestGenerated extends
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeUseOnObject.kt")
|
||||
public void testTypeUseOnObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jsr305")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -48,6 +48,12 @@ public class ForeignJava8AnnotationsNoAnnotationInClasspathWithFastClassReadingT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeUseOnObject.kt")
|
||||
public void testTypeUseOnObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jsr305")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -48,6 +48,12 @@ public class ForeignJava8AnnotationsTestGenerated extends AbstractForeignJava8An
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeUseOnObject.kt")
|
||||
public void testTypeUseOnObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotationsJava8/tests/typeUseOnObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/foreignAnnotationsJava8/tests/jsr305")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user