@@ -45,7 +45,7 @@ object Feature:
4545 val magic = experimental(" magic" )
4646 val inlineTraits = experimental(" inlineTraits" )
4747 val specializedTraits = experimental(" specializedTraits" )
48- val maybe = experimental(" maybe " )
48+ val errorHandling = experimental(" errorHandling " )
4949
5050 val nonViralExperimentalFeatures : Set [TermName ] =
5151 Set (captureChecking, separationChecking, safe, magic)
@@ -87,7 +87,7 @@ object Feature:
8787 (magic, " Enable extensions for working with coding agents" ),
8888 (inlineTraits, " Allow inline traits" ),
8989 (specializedTraits, " Allow specialized traits" ),
90- (maybe , " Allow T? and T ? E types" ),
90+ (errorHandling , " Allow error handling using T? and T ? E types" ),
9191 )
9292
9393 /** Features that are now standard; the language import / -language choice is
@@ -195,8 +195,10 @@ object Feature:
195195 || enabledBySetting(specializedTraits)
196196 || ctx.compilationUnit.knowsInlineTraits
197197
198- def maybeEnabled (using Context ) =
199- enabled(maybe) || magicEnabled
198+ def errorHandlingEnabled (using Context ) =
199+ ctx.originalCompilationUnit.newErrorHandling
200+ || enabledBySetting(errorHandling)
201+ || enabledBySetting(magic)
200202
201203 /** Is pureFunctions enabled for this compilation unit? */
202204 def pureFunsEnabled (using Context ) =
@@ -283,7 +285,7 @@ object Feature:
283285 || sym.exists && defn.ccExperimental.contains(sym.owner))
284286
285287 private def magicException (sym : Symbol )(using Context ): Boolean =
286- Feature .magicEnabled && sym.isContainedIn(defn. MagicPackageClass )
288+ Feature .magicEnabled // magic enables all experimental definitions
287289
288290 def checkExperimentalDef (sym : Symbol , srcPos : SrcPos )(using Context ) =
289291 val experimentalSym =
@@ -354,12 +356,16 @@ object Feature:
354356 case `magic` =>
355357 enableCC()
356358 ctx.compilationUnit.magic = true
359+ ctx.compilationUnit.newErrorHandling = true
357360 ctx.compilationUnit.sourceVersion = Some (SourceVersion .future)
358361 true
359362 case `inlineTraits` =>
360363 ctx.compilationUnit.knowsInlineTraits = true
361364 if ctx.run != null then ctx.run.nn.inlineTraitsImportEncountered = true
362365 true
366+ case `errorHandling` =>
367+ ctx.compilationUnit.newErrorHandling = true
368+ true
363369 case _ =>
364370 false
365371
0 commit comments