@@ -476,6 +476,7 @@ object Contexts {
476476 def setRunInfo (runInfo : RunInfo ): this .type = { this .runInfo = runInfo; this }
477477 def setDiagnostics (diagnostics : Option [StringBuilder ]): this .type = { this .diagnostics = diagnostics; this }
478478 def setGadt (gadt : GADTMap ): this .type = { this .gadt = gadt; this }
479+ def setFreshGADTBounds : this .type = setGadt(new GADTMap (gadt.bounds))
479480 def setTypeComparerFn (tcfn : Context => TypeComparer ): this .type = { this .typeComparer = tcfn(this ); this }
480481 def setSearchHistory (searchHistory : SearchHistory ): this .type = { this .searchHistory = searchHistory; this }
481482 def setFreshNames (freshNames : FreshNameCreator ): this .type = { this .freshNames = freshNames; this }
@@ -493,7 +494,6 @@ object Contexts {
493494 def setSetting [T ](setting : Setting [T ], value : T ): this .type =
494495 setSettings(setting.updateIn(sstate, value))
495496
496- def setFreshGADTBounds : this .type = { this .gadt = new GADTMap (gadt.bounds); this }
497497
498498 def setDebug = setSetting(base.settings.debug, true )
499499 }
@@ -532,7 +532,7 @@ object Contexts {
532532 moreProperties = Map .empty
533533 typeComparer = new TypeComparer (this )
534534 searchHistory = new SearchHistory (0 , Map ())
535- gadt = new GADTMap ( SimpleMap . Empty )
535+ gadt = EmptyGADTMap
536536 }
537537
538538 @ sharable object NoContext extends Context {
@@ -694,10 +694,14 @@ object Contexts {
694694 implicit val ctx : Context = initctx
695695 }
696696
697- class GADTMap (initBounds : SimpleMap [Symbol , TypeBounds ]) {
697+ class GADTMap (initBounds : SimpleMap [Symbol , TypeBounds ]) extends util. DotClass {
698698 private var myBounds = initBounds
699699 def setBounds (sym : Symbol , b : TypeBounds ): Unit =
700700 myBounds = myBounds.updated(sym, b)
701701 def bounds = myBounds
702702 }
703+
704+ @ sharable object EmptyGADTMap extends GADTMap (SimpleMap .Empty ) {
705+ override def setBounds (sym : Symbol , b : TypeBounds ) = unsupported(" EmptyGADTMap.setBounds" )
706+ }
703707}
0 commit comments