Fix compiler tests
This commit is contained in:
Vendored
+2
-2
@@ -24,7 +24,7 @@ import java.util.*
|
||||
}
|
||||
|
||||
abstract class TagWithText(name : String) : Tag(name) {
|
||||
fun String.plus() {
|
||||
operator fun String.plus() {
|
||||
children.add(TextElement(this))
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ import java.util.*
|
||||
}
|
||||
}
|
||||
|
||||
fun MutableMap<String, String>.set(key : String, value : String) = this.put(key, value)
|
||||
operator fun MutableMap<String, String>.set(key : String, value : String) = this.put(key, value)
|
||||
|
||||
fun html(init : HTML.() -> Unit) : HTML {
|
||||
val html = HTML()
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ fun <T: Any, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
||||
|
||||
class A
|
||||
|
||||
fun A.plus(<warning>a</warning> : Any) {
|
||||
operator fun A.plus(<warning>a</warning> : Any) {
|
||||
|
||||
1.foo()
|
||||
true.<error>foo</error>(<error><error>)</error></error>
|
||||
@@ -21,7 +21,7 @@ fun A.plus(<warning>a</warning> : Any) {
|
||||
<warning>1</warning>
|
||||
}
|
||||
|
||||
fun A.plus(<warning>a</warning> : Int) {
|
||||
operator fun A.plus(<warning>a</warning> : Int) {
|
||||
<warning>1</warning>
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ fun Int.foo() = this
|
||||
val foo : Int = 0
|
||||
}
|
||||
|
||||
fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
|
||||
operator fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any?.equals1(<warning>other</warning> : Any?) : Boolean = true
|
||||
fun Any.equals2(<warning>other</warning> : Any?) : Boolean = true
|
||||
|
||||
|
||||
+17
-17
@@ -7,64 +7,64 @@ class NotRange1() {
|
||||
}
|
||||
|
||||
abstract class NotRange2() {
|
||||
abstract fun iterator() : Unit
|
||||
abstract operator fun iterator() : Unit
|
||||
}
|
||||
|
||||
abstract class ImproperIterator1 {
|
||||
abstract fun hasNext() : Boolean
|
||||
abstract operator fun hasNext() : Boolean
|
||||
}
|
||||
|
||||
abstract class NotRange3() {
|
||||
abstract fun iterator() : ImproperIterator1
|
||||
abstract operator fun iterator() : ImproperIterator1
|
||||
}
|
||||
|
||||
abstract class ImproperIterator2 {
|
||||
abstract fun next() : Boolean
|
||||
abstract operator fun next() : Boolean
|
||||
}
|
||||
|
||||
abstract class NotRange4() {
|
||||
abstract fun iterator() : ImproperIterator2
|
||||
abstract operator fun iterator() : ImproperIterator2
|
||||
}
|
||||
|
||||
abstract class ImproperIterator3 {
|
||||
abstract fun hasNext() : Int
|
||||
abstract fun next() : Int
|
||||
abstract operator fun hasNext() : Int
|
||||
abstract operator fun next() : Int
|
||||
}
|
||||
|
||||
abstract class NotRange5() {
|
||||
abstract fun iterator() : ImproperIterator3
|
||||
abstract operator fun iterator() : ImproperIterator3
|
||||
}
|
||||
|
||||
abstract class AmbiguousHasNextIterator {
|
||||
abstract fun hasNext() : Boolean
|
||||
abstract operator fun hasNext() : Boolean
|
||||
val hasNext : Boolean get() = false
|
||||
abstract fun next() : Int
|
||||
abstract operator fun next() : Int
|
||||
}
|
||||
|
||||
abstract class NotRange6() {
|
||||
abstract fun iterator() : AmbiguousHasNextIterator
|
||||
abstract operator fun iterator() : AmbiguousHasNextIterator
|
||||
}
|
||||
|
||||
abstract class ImproperIterator4 {
|
||||
val hasNext : Int get() = 1
|
||||
abstract fun next() : Int
|
||||
abstract operator fun next() : Int
|
||||
}
|
||||
|
||||
abstract class NotRange7() {
|
||||
abstract fun iterator() : ImproperIterator3
|
||||
abstract operator fun iterator() : ImproperIterator3
|
||||
}
|
||||
|
||||
abstract class GoodIterator {
|
||||
abstract fun hasNext() : Boolean
|
||||
abstract fun next() : Int
|
||||
abstract operator fun hasNext() : Boolean
|
||||
abstract operator fun next() : Int
|
||||
}
|
||||
|
||||
abstract class Range0() {
|
||||
abstract fun iterator() : GoodIterator
|
||||
abstract operator fun iterator() : GoodIterator
|
||||
}
|
||||
|
||||
abstract class Range1() {
|
||||
abstract fun iterator() : Iterator<Int>
|
||||
abstract operator fun iterator() : Iterator<Int>
|
||||
}
|
||||
|
||||
fun test(notRange1: NotRange1, notRange2: NotRange2, notRange3: NotRange3, notRange4: NotRange4, notRange5: NotRange5, notRange6: NotRange6, notRange7: NotRange7, range0: Range0, range1: Range1) {
|
||||
|
||||
Vendored
+6
-6
@@ -1,6 +1,6 @@
|
||||
class IncDec() {
|
||||
fun inc() : IncDec = this
|
||||
fun dec() : IncDec = this
|
||||
operator fun inc() : IncDec = this
|
||||
operator fun dec() : IncDec = this
|
||||
}
|
||||
|
||||
fun testIncDec() {
|
||||
@@ -16,8 +16,8 @@ fun testIncDec() {
|
||||
}
|
||||
|
||||
class WrongIncDec() {
|
||||
fun inc() : Int = 1
|
||||
fun dec() : Int = 1
|
||||
operator fun inc() : Int = 1
|
||||
operator fun dec() : Int = 1
|
||||
}
|
||||
|
||||
fun testWrongIncDec() {
|
||||
@@ -29,8 +29,8 @@ fun testWrongIncDec() {
|
||||
}
|
||||
|
||||
class UnitIncDec() {
|
||||
fun inc() : Unit {}
|
||||
fun dec() : Unit {}
|
||||
operator fun inc() : Unit {}
|
||||
operator fun dec() : Unit {}
|
||||
}
|
||||
|
||||
fun testUnitIncDec() {
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
class A {
|
||||
fun component1() = 42
|
||||
fun component2() = 42
|
||||
operator fun component1() = 42
|
||||
operator fun component2() = 42
|
||||
}
|
||||
|
||||
fun arrayA(): Array<A> = null!!
|
||||
|
||||
@@ -46,7 +46,7 @@ PsiJetFileStubImpl[package=a.b.c]
|
||||
REFERENCE_EXPRESSION:[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION:[referencedName=String]
|
||||
FUN:[fqName=a.b.c.DataClass.component1, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=component1]
|
||||
MODIFIER_LIST:[public final]
|
||||
MODIFIER_LIST:[public final operator]
|
||||
VALUE_PARAMETER_LIST:
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
@@ -54,7 +54,7 @@ PsiJetFileStubImpl[package=a.b.c]
|
||||
REFERENCE_EXPRESSION:[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION:[referencedName=Int]
|
||||
FUN:[fqName=a.b.c.DataClass.component2, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, name=component2]
|
||||
MODIFIER_LIST:[public final]
|
||||
MODIFIER_LIST:[public final operator]
|
||||
VALUE_PARAMETER_LIST:
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
interface <info textAttributesKey="KOTLIN_TRAIT">FunctionLike</info> {
|
||||
fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">invoke</info>() {
|
||||
<info descr="null" textAttributesKey="KOTLIN_BUILTIN_ANNOTATION">operator</info> fun <info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">invoke</info>() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class MyClass {}
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.get(i: MyClass): MyClass { return i }
|
||||
@Deprecated("Use A instead") operator fun MyClass.get(i: MyClass): MyClass { return i }
|
||||
|
||||
fun test() {
|
||||
val x1 = MyClass()
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ class MyClass {
|
||||
val i = 0
|
||||
}
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.inc(): MyClass { return MyClass() }
|
||||
@Deprecated("Use A instead") operator fun MyClass.inc(): MyClass { return MyClass() }
|
||||
|
||||
fun test() {
|
||||
var x3 = MyClass()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class MyRunnable() {}
|
||||
|
||||
@Deprecated("Use A instead") fun MyRunnable.invoke() {
|
||||
@Deprecated("Use A instead") operator fun MyRunnable.invoke() {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
|
||||
+8
-8
@@ -2,18 +2,18 @@ class MyClass {
|
||||
val i = 0
|
||||
}
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.minus(i: MyClass) { i.i }
|
||||
@Deprecated("Use A instead") fun MyClass.div(i: MyClass) { i.i }
|
||||
@Deprecated("Use A instead") fun MyClass.times(i: MyClass) { i.i }
|
||||
@Deprecated("Use A instead") operator fun MyClass.minus(i: MyClass) { i.i }
|
||||
@Deprecated("Use A instead") operator fun MyClass.div(i: MyClass) { i.i }
|
||||
@Deprecated("Use A instead") operator fun MyClass.times(i: MyClass) { i.i }
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.not() { }
|
||||
@Deprecated("Use A instead") fun MyClass.plus() { }
|
||||
@Deprecated("Use A instead") operator fun MyClass.not() { }
|
||||
@Deprecated("Use A instead") operator fun MyClass.plus() { }
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.contains(i: MyClass): Boolean { i.i; return false }
|
||||
@Deprecated("Use A instead") operator fun MyClass.contains(i: MyClass): Boolean { i.i; return false }
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.plusAssign(i: MyClass) { i.i }
|
||||
@Deprecated("Use A instead") operator fun MyClass.plusAssign(i: MyClass) { i.i }
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.rangeTo(i: MyClass): IntRange { return IntRange(i.i, i.i) }
|
||||
@Deprecated("Use A instead") operator fun MyClass.rangeTo(i: MyClass): IntRange { return IntRange(i.i, i.i) }
|
||||
|
||||
fun test() {
|
||||
val x1 = MyClass()
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ class MyClass {
|
||||
val i = 1
|
||||
}
|
||||
|
||||
@Deprecated("Use A instead") fun MyClass.rangeTo(i: MyClass): Iterable<Int> {
|
||||
@Deprecated("Use A instead") operator fun MyClass.rangeTo(i: MyClass): Iterable<Int> {
|
||||
i.i
|
||||
throw Exception()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> operator <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
fun foo(a: Boolean, b: Boolean) : Boolean {
|
||||
return !<caret>(!a + b)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Import" "true"
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> operator <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
|
||||
package h
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package util
|
||||
|
||||
fun h.H?.plus(s: String) = ""
|
||||
operator fun h.H?.plus(s: String) = ""
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Import" "true"
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> operator <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
|
||||
package h
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package util
|
||||
|
||||
fun h.H.div(i: Int) = 3
|
||||
fun h.H.timesAssign(i: Int) {}
|
||||
operator fun h.H.div(i: Int) = 3
|
||||
operator fun h.H.timesAssign(i: Int) {}
|
||||
@@ -1,3 +1,3 @@
|
||||
package util
|
||||
|
||||
fun h.H?.minus() = ""
|
||||
operator fun h.H?.minus() = ""
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Import" "true"
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> <b>fun</b> h.A.plus(): kotlin.Int <i>defined in</i> h</li><li><b>public</b> <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> operator <b>fun</b> h.A.plus(): kotlin.Int <i>defined in</i> h</li><li><b>public</b> operator <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
|
||||
package h
|
||||
|
||||
@@ -13,4 +13,4 @@ fun f(h: H?) {
|
||||
|
||||
class A()
|
||||
|
||||
fun A.plus(): Int = 3
|
||||
operator fun A.plus(): Int = 3
|
||||
@@ -1,3 +1,3 @@
|
||||
package util
|
||||
|
||||
fun h.H.plus() = ""
|
||||
operator fun h.H.plus() = ""
|
||||
@@ -1,5 +1,5 @@
|
||||
// "Import" "true"
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> <b>fun</b> h.A.plus(): kotlin.Int <i>defined in</i> h</li><li><b>public</b> <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
// ERROR: <html>Unresolved reference. <br/> None of the following candidates is applicable because of receiver type mismatch: <ul><li><b>public</b> operator <b>fun</b> h.A.plus(): kotlin.Int <i>defined in</i> h</li><li><b>public</b> operator <b>fun</b> kotlin.String?.plus(other: kotlin.Any?): kotlin.String <i>defined in</i> kotlin</li></ul></html>
|
||||
|
||||
package h
|
||||
|
||||
@@ -11,4 +11,4 @@ fun f(h: H?) {
|
||||
|
||||
class A()
|
||||
|
||||
fun A.plus(): Int = 3
|
||||
operator fun A.plus(): Int = 3
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddFunctionParametersFix" "false"
|
||||
// ERROR: Too many arguments for public open fun equals(other: kotlin.Any?): kotlin.Boolean defined in kotlin.Any
|
||||
// ERROR: Too many arguments for public open operator fun equals(other: kotlin.Any?): kotlin.Boolean defined in kotlin.Any
|
||||
|
||||
fun f(d: Any) {
|
||||
d.equals("a", <caret>"b")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.AddFunctionParametersFix" "false"
|
||||
//ERROR: Too many arguments for public final fun component1(): kotlin.Int defined in Data
|
||||
//ERROR: Too many arguments for public final operator fun component1(): kotlin.Int defined in Data
|
||||
|
||||
data class Data(val i: Int) {}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// DISABLE-ERRORS
|
||||
val array = Array(2) { it }
|
||||
fun <T> Array<T>.contains(t: T): Boolean = false
|
||||
operator fun <T> Array<T>.contains(t: T): Boolean = false
|
||||
|
||||
val a = <selection>1 in array</selection>
|
||||
val b = array.contains(1)
|
||||
|
||||
Reference in New Issue
Block a user