Add data modifier to a class quickfix #KT-18220 Fixed

This commit is contained in:
Toshiaki Kameyama
2017-09-19 03:19:05 +03:00
committed by Mikhail Glukhikh
parent f08e9832a6
commit 1043284afe
27 changed files with 409 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Cannot create an instance of an abstract class
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
abstract class Foo(val bar: String, val baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+14
View File
@@ -0,0 +1,14 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Test.Foo.component1'
// ACTION: Create extension function 'Test.Foo.component2'
// ACTION: Create member function 'Test.Foo.component1'
// ACTION: Create member function 'Test.Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Destructuring declaration initializer of type Test.Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Test.Foo must have a 'component2()' function
class Test {
inner class Foo(val bar: String, val baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
}
@@ -0,0 +1,13 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
class Foo(private val bar: String, var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
@@ -0,0 +1,13 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
class Foo(protected val bar: String, var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+12
View File
@@ -0,0 +1,12 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
class Foo()
fun test() {
var (bar, baz) = Foo()<caret>
}
+13
View File
@@ -0,0 +1,13 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
class Foo(val bar: String, baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+13
View File
@@ -0,0 +1,13 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
open class Foo(val bar: String, val baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+15
View File
@@ -0,0 +1,15 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Cannot access '<init>': it is private in 'Foo'
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
// ERROR: Sealed types cannot be instantiated
sealed class Foo(val bar: String, val baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+6
View File
@@ -0,0 +1,6 @@
// "Make 'Foo' data class" "true"
class Foo(val bar: String, var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+6
View File
@@ -0,0 +1,6 @@
// "Make 'Foo' data class" "true"
data class Foo(val bar: String, var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+7
View File
@@ -0,0 +1,7 @@
// "Make 'Foo' data class" "true"
class Foo(val bar: String, var baz: Int)
fun test() {
val foo = Foo("A", 1)
var (bar, baz) = foo<caret>
}
+7
View File
@@ -0,0 +1,7 @@
// "Make 'Foo' data class" "true"
data class Foo(val bar: String, var baz: Int)
fun test() {
val foo = Foo("A", 1)
var (bar, baz) = foo<caret>
}
+9
View File
@@ -0,0 +1,9 @@
// "Make 'Foo' data class" "true"
// WITH_RUNTIME
class Foo(val bar: String, var baz: Int)
fun test() {
val list = listOf(Foo("A", 1))
list.forEach { (foo<caret>, bar) ->
}
}
+9
View File
@@ -0,0 +1,9 @@
// "Make 'Foo' data class" "true"
// WITH_RUNTIME
data class Foo(val bar: String, var baz: Int)
fun test() {
val list = listOf(Foo("A", 1))
list.forEach { (foo<caret>, bar) ->
}
}
+9
View File
@@ -0,0 +1,9 @@
// "Make 'Foo' data class" "true"
// WITH_RUNTIME
class Foo(val bar: String, var baz: Int)
fun test() {
val list = listOf(Foo("A", 1))
for ((foo, bar) in list<caret>) {
}
}
+9
View File
@@ -0,0 +1,9 @@
// "Make 'Foo' data class" "true"
// WITH_RUNTIME
data class Foo(val bar: String, var baz: Int)
fun test() {
val list = listOf(Foo("A", 1))
for ((foo, bar) in list<caret>) {
}
}
+6
View File
@@ -0,0 +1,6 @@
// "Make 'Foo' data class" "true"
class Foo(private val bar: String, protected var baz: Int) {
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
}
+6
View File
@@ -0,0 +1,6 @@
// "Make 'Foo' data class" "true"
data class Foo(private val bar: String, protected var baz: Int) {
fun test() {
var (bar, baz) = Foo("A", 1)
}
}
+8
View File
@@ -0,0 +1,8 @@
// "Make 'Foo' data class" "true"
class Foo(private val bar: String, protected var baz: Int) {
class A {
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
}
}
+8
View File
@@ -0,0 +1,8 @@
// "Make 'Foo' data class" "true"
data class Foo(private val bar: String, protected var baz: Int) {
class A {
fun test() {
var (bar, baz) = Foo("A", 1)
}
}
}
+6
View File
@@ -0,0 +1,6 @@
// "Make 'Foo' data class" "true"
class Foo(internal val bar: String, var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+6
View File
@@ -0,0 +1,6 @@
// "Make 'Foo' data class" "true"
data class Foo(internal val bar: String, var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}
+13
View File
@@ -0,0 +1,13 @@
// "Make 'Foo' data class" "false"
// ACTION: Create extension function 'Foo.component1'
// ACTION: Create extension function 'Foo.component2'
// ACTION: Create member function 'Foo.component1'
// ACTION: Create member function 'Foo.component2'
// ACTION: Put arguments on separate lines
// ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function
class Foo(val bar: String, vararg var baz: Int)
fun test() {
var (bar, baz) = Foo("A", 1)<caret>
}