@@ -4,6 +4,7 @@ import dotty.tools.DottyTest
4
4
import dotty .tools .dotc .rewrites .Rewrites
5
5
import dotty .tools .dotc .rewrites .Rewrites .ActionPatch
6
6
import dotty .tools .dotc .util .SourceFile
7
+ import dotty .tools .dotc .core .Contexts ._
7
8
8
9
import scala .annotation .tailrec
9
10
import scala .jdk .CollectionConverters .*
@@ -136,35 +137,6 @@ class CodeActionTest extends DottyTest:
136
137
afterPhase = " patternMatcher"
137
138
)
138
139
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
-
168
140
@ Test def addNN1 =
169
141
val ctxx = newContext
170
142
ctxx.setSetting(ctxx.settings.YexplicitNulls , true )
@@ -278,12 +250,12 @@ class CodeActionTest extends DottyTest:
278
250
ctxx.setSetting(ctxx.settings.YexplicitNulls , true )
279
251
checkCodeAction(
280
252
code =
281
- """ given ctx: String | Null = null
253
+ """ given ctx: ( String | Null) = null
282
254
|def f(using c: String): String = c
283
255
|val s: String = f(using ctx)""" .stripMargin,
284
256
title = " Add .nn" ,
285
257
expected =
286
- """ given ctx: String | Null = null
258
+ """ given ctx: ( String | Null) = null
287
259
|def f(using c: String): String = c
288
260
|val s: String = f(using ctx.nn)""" .stripMargin,
289
261
ctxx = ctxx
@@ -295,8 +267,8 @@ class CodeActionTest extends DottyTest:
295
267
val rep = new StoreReporter (null ) with UniqueMessagePositions with HideNonSensicalMessages
296
268
initialCtx.setReporter(rep).withoutColors
297
269
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
300
272
val source = SourceFile .virtual(" test" , code).content
301
273
val runCtx = checkCompile(afterPhase, code) { (_, _) => () }
302
274
val diagnostics = runCtx.reporter.removeBufferedMessages
0 commit comments