diff options
Diffstat (limited to 'src/test/kotlin/com/replaymod/gradle')
-rw-r--r-- | src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt b/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt index a3a6efc..d24d2e6 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/pattern/TestFieldReference.kt @@ -37,4 +37,37 @@ class TestFieldReference { } """.trimIndent() } + + @Test + fun `should not match final field on left side of assignment when replaced by non-field`() { + TestData.remap("test/Test.java", """ + class Test { + Test field; + private void test() { + field = field; + this.field = this.field; + this.field.field = this.field.field; + } + } + """.trimIndent(), """ + @remap.Pattern + private test.Test pattern(test.Test obj) { + return obj.field; + } + """.trimIndent(), """ + @remap.Pattern + private test.Test pattern(test.Test obj) { + return matched(obj); + } + """.trimIndent()) shouldBe """ + class Test { + Test field; + private void test() { + field = field; + this.field = matched(this); + matched(this).field = matched(matched(this)); + } + } + """.trimIndent() + } }
\ No newline at end of file |