Skip to content

Commit

Permalink
Merge pull request #73 from nomisRev/sealed-properties
Browse files Browse the repository at this point in the history
Parser tests for sealed properties
  • Loading branch information
traceyyoshima authored Apr 6, 2023
2 parents ed07afb + d4062ee commit 74da050
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,58 @@ void variance() {
);
}

@Issue("https://github.com/openrewrite/rewrite-kotlin/issues/72")
@Test
@ExpectedToFail
void sealedClassWithPropertiesAndDataClass() {
rewriteRun(
kotlin(
"""
sealed class InvalidField {
val field: String
}
data class InvalidEmail( val errors : List<String> ) : InvalidField ( ) {
override val field : String = "email"
}
"""
)
);
}

@Issue("https://github.com/openrewrite/rewrite-kotlin/issues/72")
@Test
@ExpectedToFail
void sealedInterfaceWithPropertiesAndDataClass() {
rewriteRun(
kotlin(
"""
sealed interface InvalidField {
val field : String
}
data class InvalidEmail( val errors : List<String> ) : InvalidField {
override val field : String = "email"
}
"""
)
);
}

@Test
void sealedInterfaceWithPropertiesAndObject() {
rewriteRun(
kotlin(
"""
sealed interface InvalidField {
val field : String
}
object InvalidEmail : InvalidField {
override val field : String = "email"
}
"""
)
);
}

@Issue("https://github.com/openrewrite/rewrite-kotlin/issues/68")
@Test
void init() {
Expand Down

0 comments on commit 74da050

Please sign in to comment.