[FIR] Remove links to spec sentences during comparison fir and old front-end test data

This commit is contained in:
Victor Petukhov
2020-03-29 21:30:34 +03:00
parent a29385e758
commit 218c13efc5
9 changed files with 12 additions and 1 deletions
@@ -4,6 +4,7 @@
* RELEVANT SPEC SENTENCES (spec version: 0.1-220, test type: pos):
* - expressions, call-and-property-access-expressions, callable-references -> paragraph 11 -> sentence 3
*/
import kotlin.reflect.KFunction0
fun test() {
@@ -5,6 +5,7 @@
* - expressions, call-and-property-access-expressions, navigation-operators -> paragraph 9 -> sentence 2
* - expressions, call-and-property-access-expressions, navigation-operators -> paragraph 8 -> sentence 1
*/
import kotlin.reflect.KProperty1
class DTO {
+1
View File
@@ -1,4 +1,5 @@
// !WITH_NEW_INFERENCE
fun Int.foo() : Boolean = true
fun foo() : Int {
@@ -1,4 +1,5 @@
// !WITH_NEW_INFERENCE
fun foo(x: Int) = x
fun test0(flag: Boolean) {
@@ -1,4 +1,5 @@
// !WITH_NEW_INFERENCE
fun test1(): Int {
val x: String = if (true) {
when {
@@ -1,4 +1,5 @@
// !WITH_NEW_INFERENCE
val test1: (String) -> Boolean =
when {
true -> {{ true }}
@@ -1,5 +1,6 @@
// !WITH_NEW_INFERENCE
// NI_EXPECTED_FILE
val test1 = when {
true -> { { true } }
else -> TODO()
@@ -412,6 +412,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava<TestModule, Tes
val RENDER_DIAGNOSTICS_FULL_TEXT = "RENDER_DIAGNOSTICS_FULL_TEXT"
val DIAGNOSTIC_IN_TESTDATA_PATTERN = Regex("<!>|<!(.*?(\\(\".*?\"\\)|\\(\\))??)+(?<!<)!>")
val SPEC_LINKS_IN_TESTDATA_PATTERN = Regex("""/\*\s+\*\s+RELEVANT SPEC SENTENCES[\w\W]*?\*/\n""")
fun parseDiagnosticFilterDirective(
directiveMap: Directives,
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir
import com.intellij.openapi.util.text.StringUtil
import junit.framework.TestCase
import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest.Companion.DIAGNOSTIC_IN_TESTDATA_PATTERN
import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest.Companion.SPEC_LINKS_IN_TESTDATA_PATTERN
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.util.trimTrailingWhitespacesAndAddNewlineAtEOF
import java.io.File
@@ -51,6 +52,8 @@ fun compareAndMergeFirFileAndOldFrontendFile(
}
fun loadTestDataWithoutDiagnostics(file: File): String {
val textWithoutDiagnostics = KotlinTestUtils.doLoadFile(file).replace(DIAGNOSTIC_IN_TESTDATA_PATTERN, "")
val textWithoutDiagnostics = KotlinTestUtils.doLoadFile(file)
.replace(DIAGNOSTIC_IN_TESTDATA_PATTERN, "")
.replace(SPEC_LINKS_IN_TESTDATA_PATTERN, "")
return StringUtil.convertLineSeparators(textWithoutDiagnostics.trim()).trimTrailingWhitespacesAndAddNewlineAtEOF()
}