From 3b17b3fac74cbed3583d2d667d6112879b2e0440 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Tue, 15 Nov 2011 19:54:46 +0400 Subject: [PATCH] typer tests for backing fields --- .../quick/backingField/CustomGetSet.jet | 7 +++++++ .../quick/backingField/CustomGetVal.jet | 4 ++++ .../quick/backingField/CustomGetVar.jet | 4 ++++ .../quick/backingField/CustomSet.jet | 4 ++++ .../quick/backingField/CyclicReferenceInitializer.jet | 3 +++ .../quick/backingField/ReadForwardInAnonymous.jet | 7 +++++++ .../backingField/ReadForwardInPropertyInitializer.jet | 4 ++++ .../quick/backingField/ReadInAnonymous.jet | 6 ++++++ .../backingField/ReadInAnotherPropertyIntializer.jet | 4 ++++ .../quick/backingField/ReadInFunction.jet | 4 ++++ .../ReadNonexistentAbstractPropertyInFunction.jet | 5 +++++ .../backingField/ReadNonexistentCustomGetInAnonymous.jet | 8 ++++++++ .../ReadNonexistentCustomGetInAnotherInitializer.jet | 6 ++++++ .../backingField/ReadNonexistentPropertyInAnonymous.jet | 5 +++++ 14 files changed, 71 insertions(+) create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetSet.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVal.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVar.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/CustomSet.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/CyclicReferenceInitializer.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInAnonymous.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInPropertyInitializer.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnonymous.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnotherPropertyIntializer.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInFunction.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentAbstractPropertyInFunction.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnonymous.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnotherInitializer.jet create mode 100644 compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentPropertyInAnonymous.jet diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetSet.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetSet.jet new file mode 100644 index 00000000000..7536aa3339e --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetSet.jet @@ -0,0 +1,7 @@ +class Flower() { + + var minusOne: Int = 1 + get() = $minusOne + 1 + set(n: Int) { $minusOne = n - 1 } + +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVal.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVal.jet new file mode 100644 index 00000000000..f598fc264a0 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVal.jet @@ -0,0 +1,4 @@ +class CustomGetVal() { + val zz = 1 + get() = $zz * 2 +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVar.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVar.jet new file mode 100644 index 00000000000..89eb1702848 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomGetVar.jet @@ -0,0 +1,4 @@ +class Raise() { + var zz = 1 + get() = $zz * 2 +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomSet.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomSet.jet new file mode 100644 index 00000000000..54e60a8d95d --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/CustomSet.jet @@ -0,0 +1,4 @@ +class Raise() { + var zz = 1 + set(it) { $zz = it / 2 } +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/CyclicReferenceInitializer.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/CyclicReferenceInitializer.jet new file mode 100644 index 00000000000..9970bbe43b7 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/CyclicReferenceInitializer.jet @@ -0,0 +1,3 @@ +class Cyclic() { + val a = $a +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInAnonymous.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInAnonymous.jet new file mode 100644 index 00000000000..00406dc599c --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInAnonymous.jet @@ -0,0 +1,7 @@ +class ReadForward() { + { + val x = $a + } + + val a = 1 +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInPropertyInitializer.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInPropertyInitializer.jet new file mode 100644 index 00000000000..d5f35c0f7ca --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadForwardInPropertyInitializer.jet @@ -0,0 +1,4 @@ +class ReadForward() { + val a = $b + val b = 1 +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnonymous.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnonymous.jet new file mode 100644 index 00000000000..183ac58ec72 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnonymous.jet @@ -0,0 +1,6 @@ +class ReadByAnotherPropertyInitializer() { + val a = 1 + { + val x = $a + } +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnotherPropertyIntializer.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnotherPropertyIntializer.jet new file mode 100644 index 00000000000..864a13def97 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInAnotherPropertyIntializer.jet @@ -0,0 +1,4 @@ +class ReadByAnotherPropertyInitializer() { + val a = 1 + val b = $a +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInFunction.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInFunction.jet new file mode 100644 index 00000000000..dac44656db9 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadInFunction.jet @@ -0,0 +1,4 @@ +class ReadByAnotherPropertyInitializer() { + val a = 1 + fun ff() = $a +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentAbstractPropertyInFunction.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentAbstractPropertyInFunction.jet new file mode 100644 index 00000000000..bb29feddfae --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentAbstractPropertyInFunction.jet @@ -0,0 +1,5 @@ +abstract class ReadNonexistent { + abstract val aa: Int + + fun ff() = $aa +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnonymous.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnonymous.jet new file mode 100644 index 00000000000..be275ba22fc --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnonymous.jet @@ -0,0 +1,8 @@ +class ReadNonexistent() { + val a: Int + get() = 1 + + { + val x = $a + } +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnotherInitializer.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnotherInitializer.jet new file mode 100644 index 00000000000..80b852f68b0 --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentCustomGetInAnotherInitializer.jet @@ -0,0 +1,6 @@ +class CustomValNoBackingField() { + val a: Int + get() = 1 + + val b = $a +} diff --git a/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentPropertyInAnonymous.jet b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentPropertyInAnonymous.jet new file mode 100644 index 00000000000..a2d911c6dea --- /dev/null +++ b/compiler/testData/checkerWithErrorTypes/quick/backingField/ReadNonexistentPropertyInAnonymous.jet @@ -0,0 +1,5 @@ +class Cl() { + { + val x = $a + } +}