@@ -4,6 +4,7 @@ import dotty.tools.DottyTest
44import dotty .tools .dotc .rewrites .Rewrites
55import dotty .tools .dotc .rewrites .Rewrites .ActionPatch
66import dotty .tools .dotc .util .SourceFile
7+ import dotty .tools .dotc .core .Contexts ._
78
89import scala .annotation .tailrec
910import scala .jdk .CollectionConverters .*
@@ -136,35 +137,6 @@ class CodeActionTest extends DottyTest:
136137 afterPhase = " patternMatcher"
137138 )
138139
139- @ Test def removeNN =
140- val ctxx = newContext
141- ctxx.setSetting(ctxx.settings.YexplicitNulls , true )
142- checkCodeAction(
143- code =
144- """ |val s: String|Null = "foo".nn
145- |""" .stripMargin,
146- title = " Remove unnecessary .nn" ,
147- expected =
148- """ |val s: String|Null = "foo"
149- |""" .stripMargin,
150- ctxx = ctxx
151- )
152-
153-
154- @ Test def removeNN2 =
155- val ctxx = newContext
156- ctxx.setSetting(ctxx.settings.YexplicitNulls , true )
157- checkCodeAction(
158- code =
159- """ val s: String|Null = null.nn
160- |""" .stripMargin,
161- title = " Remove unnecessary .nn" ,
162- expected =
163- """ val s: String|Null = null
164- |""" .stripMargin,
165- ctxx = ctxx
166- )
167-
168140 @ Test def addNN1 =
169141 val ctxx = newContext
170142 ctxx.setSetting(ctxx.settings.YexplicitNulls , true )
@@ -278,12 +250,12 @@ class CodeActionTest extends DottyTest:
278250 ctxx.setSetting(ctxx.settings.YexplicitNulls , true )
279251 checkCodeAction(
280252 code =
281- """ given ctx: String | Null = null
253+ """ given ctx: ( String | Null) = null
282254 |def f(using c: String): String = c
283255 |val s: String = f(using ctx)""" .stripMargin,
284256 title = " Add .nn" ,
285257 expected =
286- """ given ctx: String | Null = null
258+ """ given ctx: ( String | Null) = null
287259 |def f(using c: String): String = c
288260 |val s: String = f(using ctx.nn)""" .stripMargin,
289261 ctxx = ctxx
@@ -295,8 +267,8 @@ class CodeActionTest extends DottyTest:
295267 val rep = new StoreReporter (null ) with UniqueMessagePositions with HideNonSensicalMessages
296268 initialCtx.setReporter(rep).withoutColors
297269
298- private def checkCodeAction (code : String , title : String , expected : String , afterPhase : String = " typer" ) =
299- ctx = newContext
270+ private def checkCodeAction (code : String , title : String , expected : String , afterPhase : String = " typer" , ctxx : Context = newContext ) =
271+ ctx = ctxx
300272 val source = SourceFile .virtual(" test" , code).content
301273 val runCtx = checkCompile(afterPhase, code) { (_, _) => () }
302274 val diagnostics = runCtx.reporter.removeBufferedMessages
0 commit comments