Migrate compiler, idea and others to new case conversion api

This commit is contained in:
Abduqodiri Qurbonzoda
2021-04-08 02:28:57 +03:00
parent aa543c6631
commit 40d1849f33
138 changed files with 239 additions and 224 deletions
@@ -19,14 +19,14 @@
fun case_1(x: Class?, y: Any) {
x?.prop_12 = if (y is String) "" else throw Exception()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}
// TESTCASE NUMBER: 2
fun case_2(x: Class?, y: Any) {
x?.prop_9 = y is String || return
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toUpperCase<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>uppercase<!>()
}
/*
@@ -37,7 +37,7 @@ fun case_2(x: Class?, y: Any) {
fun case_3(x: Class?, y: Any) {
x?.prop_12 = y as String
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}
/*
@@ -48,7 +48,7 @@ fun case_3(x: Class?, y: Any) {
fun case_4(x: Class?, y: Any) {
x?.prop_12 = y as? String ?: return
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}
/*
@@ -59,14 +59,14 @@ fun case_4(x: Class?, y: Any) {
fun case_5(x: Class?, y: String?) {
x?.prop_12 = y ?: return
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}
// TESTCASE NUMBER: 6
fun case_6(x: Class?, y: String?) {
x?.prop_9 = y !is String && throw Exception()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!><!UNSAFE_CALL!>.<!>toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!><!UNSAFE_CALL!>.<!>uppercase()
}
/*
@@ -77,7 +77,7 @@ fun case_6(x: Class?, y: String?) {
fun case_7(x: Class?, y: String?) {
x?.prop_12 = y!!
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}
/*
@@ -88,5 +88,5 @@ fun case_7(x: Class?, y: String?) {
fun case_8(x: Class?, y: String?) {
x?.prop_12 = if (y === null) throw Exception() else ""
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
}
@@ -41,7 +41,7 @@ object TestsJsonMapGenerator {
SECONDARY;
override fun toString(): String {
return name.toLowerCase()
return name.lowercase()
}
}
@@ -43,7 +43,7 @@ object TestsStatisticCollector {
val statistic = mutableMapOf<TestArea, SpecTestsStatElement>()
for (specTestArea in TestArea.values()) {
val specTestsPath = "$SPEC_TESTDATA_PATH/${specTestArea.name.toLowerCase().replace("_", "/")}/${testLinkedType.testDataPath}"
val specTestsPath = "$SPEC_TESTDATA_PATH/${specTestArea.name.lowercase().replace("_", "/")}/${testLinkedType.testDataPath}"
statistic[specTestArea] =
SpecTestsStatElement(SpecTestsStatElementType.AREA)
@@ -23,7 +23,7 @@ import java.util.regex.Pattern
object CommonParser {
fun String.withUnderscores() = replace(" ", "_")
.replace(File.separator, "_")
.toUpperCase()
.uppercase()
fun String.splitByComma() = split(Regex(""",\s*"""))
fun String.splitByPathSeparator() = split(File.separator)
@@ -85,8 +85,8 @@ private fun parseImplementationTestInfo(testFilePath: String, linkedTestType: Sp
testArea = TestArea.valueOf(testInfoByContentMatcher.group("testArea").withUnderscores()),
testType = TestType.valueOf(testInfoByContentMatcher.group("testType")),
testNumber = testInfoElements[CommonSpecTestFileInfoElementType.NUMBER]?.content?.toInt() ?: 0,
testDescription = fileNameWithoutExtension.toUpperCase()[0] + fileNameWithoutExtension.substring(1)
.replace(Regex("""([A-Z])"""), " $1").toLowerCase(),
testDescription = fileNameWithoutExtension.uppercase()[0] + fileNameWithoutExtension.substring(1)
.replace(Regex("""([A-Z])"""), " $1").lowercase(),
testInfoElements = testInfoElements,
testCasesSet = SpecTestCasesSet(mutableMapOf(), mutableMapOf(), mutableMapOf()), //todo
unexpectedBehavior = testInfoElements.contains(CommonInfoElementType.UNEXPECTED_BEHAVIOUR),
@@ -24,7 +24,7 @@ object HtmlSpecSentencesMapBuilder {
spec.select("$SECTION_SELECTORS, $PARAGRAPH_SELECTORS, .sentence").forEach { element ->
when {
element.`is`(SECTION_SELECTORS) -> {
val sectionTag = SectionTag.valueOf(element.tagName().toLowerCase())
val sectionTag = SectionTag.valueOf(element.tagName().lowercase())
while (!currentSectionsPath.empty() && currentSectionsPath.peek().first.level >= sectionTag.level) {
currentSectionsPath.pop()
}