Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
kunli2 committed Nov 8, 2023
1 parent 15540c6 commit 8aebe17
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ public J visitNamedDeclaration(KtNamedDeclaration declaration, ExecutionContext
@Override
public J visitNullableType(KtNullableType nullableType, ExecutionContext data) {
J j = requireNonNull(nullableType.getInnerType()).accept(this, data);
return j.withMarkers(j.getMarkers().addIfAbsent(new IsNullable(randomId(), suffix(nullableType.getInnerType()))));
return j.withMarkers(j.getMarkers().addIfAbsent(new IsNullable(randomId(),
prefix((PsiElement) nullableType.getQuestionMarkNode())
)));
}

@Override
Expand Down Expand Up @@ -1803,7 +1805,7 @@ public J visitBlockExpression(KtBlockExpression expression, ExecutionContext dat
}

boolean hasBraces = expression.getLBrace() != null;
Space end = hasBraces ? endFixPrefixAndInfix(expression.getRBrace()) : endFix(expression);
Space end = hasBraces ? deepPrefix(expression.getRBrace()) : Space.EMPTY;

Space prefix = prefix(expression);
Space blockPrefix = prefix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void parenthesizedNullableType() {
rewriteRun(
kotlin(
"""
val v: ((Any) -> Any)? = null
val v: ( ( Any ) -> Any) /*c1*/ ? = null
"""
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/openrewrite/kotlin/tree/KTSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void topLevelAssignmentExpression() {
rewriteRun(
kotlinScript("""
var x = 5
x += 1
x += 1 /*C1*/
""")
);
}
Expand Down

0 comments on commit 8aebe17

Please sign in to comment.