File tree Expand file tree Collapse file tree 5 files changed +22
-2
lines changed Expand file tree Collapse file tree 5 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ object Settings:
4747 values(idx) = x
4848 changed.add(idx)
4949 this
50+
51+ def reinitializedCopy (): SettingsState =
52+ SettingsState (values.toSeq, changed.toSet)
53+
5054 end SettingsState
5155
5256 case class ArgsSummary (
Original file line number Diff line number Diff line change @@ -342,10 +342,13 @@ object Inlines:
342342 if Inlines .isInlineable(codeArg1.symbol) then stripTyped(Inlines .inlineCall(codeArg1))
343343 else codeArg1
344344
345+ // We should not be rewriting tested strings
346+ val noRewriteSettings = ctx.settings.rewrite.updateIn(ctx.settingsState.reinitializedCopy(), None )
347+
345348 ConstFold (underlyingCodeArg).tpe.widenTermRefExpr match {
346349 case ConstantType (Constant (code : String )) =>
347350 val source2 = SourceFile .virtual(" tasty-reflect" , code)
348- inContext(ctx.fresh.setNewTyperState().setTyper(new Typer (ctx.nestingLevel + 1 )).setSource(source2)) {
351+ inContext(ctx.fresh.setSettings(noRewriteSettings). setNewTyperState().setTyper(new Typer (ctx.nestingLevel + 1 )).setSource(source2)) {
349352 val tree2 = new Parser (source2).block()
350353 if ctx.reporter.allErrors.nonEmpty then
351354 ctx.reporter.allErrors.map((ErrorKind .Parser , _))
Original file line number Diff line number Diff line change @@ -135,3 +135,6 @@ parsercombinators-new-syntax.scala
135135hylolib-deferred-given
136136hylolib-cb
137137hylolib
138+
139+ # typecheckErrors method unpickling
140+ i21415.scala
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ tuple-zip.scala
2727tuples1.scala
2828tuples1a.scala
2929tuples1b.scala
30- typeCheckErrors.scala
3130typeclass-derivation-doc-example.scala
3231typeclass-derivation1.scala
3332typeclass-derivation2.scala
@@ -47,3 +46,6 @@ trait-static-forwarder
4746i17255
4847named-tuples-strawman-2.scala
4948
49+ # typecheckErrors method unpickling
50+ typeCheckErrors.scala
51+
Original file line number Diff line number Diff line change 1+ //> using options -rewrite -source:3.4-migration
2+ import scala .compiletime .testing .typeCheckErrors
3+
4+ def foo (arg : Int ): Unit = ???
5+
6+ @ main def Test =
7+ typeCheckErrors(" Seq.empty[Int].foreach(foo.apply _)" )
8+ typeCheckErrors(" Seq.empty[Int].foreach(foo.apply _)" )
You can’t perform that action at this time.
0 commit comments