Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
560371c6
Commit
560371c6
authored
2 years ago
by
Jinseong Jeon
Browse files
Options
Download
Email Patches
Plain Diff
FIR/UAST: regression test about exp type for range operator
^KT-59564
parent
189de89a
Branches unavailable
Tags unavailable
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plugins/kotlin/uast/uast-kotlin-base/tests/test/org/jetbrains/uast/test/common/kotlin/UastApiFixtureTestBase.kt
+29
-0
...tbrains/uast/test/common/kotlin/UastApiFixtureTestBase.kt
plugins/kotlin/uast/uast-kotlin-fir/tests/test/org/jetbrains/fir/uast/test/FirUastApiFixtureTest.kt
+4
-0
...test/org/jetbrains/fir/uast/test/FirUastApiFixtureTest.kt
plugins/kotlin/uast/uast-kotlin/tests/test/org/jetbrains/uast/test/kotlin/comparison/FE1UastApiFixtureTest.kt
+4
-0
...ains/uast/test/kotlin/comparison/FE1UastApiFixtureTest.kt
with
37 additions
and
0 deletions
+37
-0
plugins/kotlin/uast/uast-kotlin-base/tests/test/org/jetbrains/uast/test/common/kotlin/UastApiFixtureTestBase.kt
+
29
-
0
View file @
560371c6
...
...
@@ -352,6 +352,35 @@ interface UastApiFixtureTestBase : UastPluginSelection {
TestCase
.
assertEquals
(
UastCallKind
.
CONSTRUCTOR_CALL
,
uCallExpression
.
kind
)
}
// Regression test from KT-59564
fun
checkExpressionTypeOfForEach
(
myFixture
:
JavaCodeInsightTestFixture
)
{
myFixture
.
configureByText
(
"main.kt"
,
"""
// !LANGUAGE: +RangeUntilOperator
@file:OptIn(ExperimentalStdlibApi::class)
fun test(a: Int, b: Int) {
for (i in a..<b step 1) {
println(i)
}
}
"""
.
trimIndent
()
)
val
uFile
=
myFixture
.
file
.
toUElement
()
!!
uFile
.
accept
(
object
:
AbstractUastVisitor
()
{
override
fun
visitForEachExpression
(
node
:
UForEachExpression
):
Boolean
{
when
(
val
exp
=
node
.
iteratedValue
.
skipParenthesizedExprDown
())
{
is
UBinaryExpression
->
{
TestCase
.
assertEquals
(
"kotlin.ranges.IntProgression"
,
exp
.
getExpressionType
()
?.
canonicalText
)
TestCase
.
assertEquals
(
"kotlin.ranges.IntRange"
,
exp
.
leftOperand
.
getExpressionType
()
?.
canonicalText
)
}
}
return
super
.
visitForEachExpression
(
node
)
}
})
}
// Regression test from KTIJ-23503
fun
checkExpressionTypeFromIncorrectObject
(
myFixture
:
JavaCodeInsightTestFixture
)
{
myFixture
.
configureByText
(
...
...
This diff is collapsed.
Click to expand it.
plugins/kotlin/uast/uast-kotlin-fir/tests/test/org/jetbrains/fir/uast/test/FirUastApiFixtureTest.kt
+
4
-
0
View file @
560371c6
...
...
@@ -57,6 +57,10 @@ class FirUastApiFixtureTest : KotlinLightCodeInsightFixtureTestCase(), UastApiFi
checkCallKindOfSamConstructor
(
myFixture
)
}
fun
testExpressionTypeOfForEach
()
{
checkExpressionTypeOfForEach
(
myFixture
)
}
fun
testExpressionTypeFromIncorrectObject
()
{
checkExpressionTypeFromIncorrectObject
(
myFixture
)
}
...
...
This diff is collapsed.
Click to expand it.
plugins/kotlin/uast/uast-kotlin/tests/test/org/jetbrains/uast/test/kotlin/comparison/FE1UastApiFixtureTest.kt
+
4
-
0
View file @
560371c6
...
...
@@ -55,6 +55,10 @@ class FE1UastApiFixtureTest : KotlinLightCodeInsightFixtureTestCase(), UastApiFi
checkCallKindOfSamConstructor
(
myFixture
)
}
fun
testExpressionTypeOfForEach
()
{
checkExpressionTypeOfForEach
(
myFixture
)
}
fun
testExpressionTypeFromIncorrectObject
()
{
checkExpressionTypeFromIncorrectObject
(
myFixture
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help