Skip to content

Commit d33db04

Browse files
authored
Merge pull request #3918 from dotty-staging/fix-#1754
Fix #1754: Don't narrow GADTs to lower bounds
2 parents f8363e3 + e07af3f commit d33db04

File tree

14 files changed

+837
-784
lines changed

14 files changed

+837
-784
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

+1
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
556556
val acc = new TreeAccumulator[List[Symbol]] {
557557
def apply(syms: List[Symbol], tree: Tree)(implicit ctx: Context) = tree match {
558558
case Bind(_, body) => apply(tree.symbol :: syms, body)
559+
case Annotated(tree, id @ Ident(tpnme.BOUNDTYPE_ANNOT)) => apply(id.symbol :: syms, tree)
559560
case _ => foldOver(syms, tree)
560561
}
561562
}

compiler/src/dotty/tools/dotc/core/StdNames.scala

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ object StdNames {
143143
val INITIALIZER_PREFIX: N = "initial$"
144144
val COMPANION_MODULE_METHOD: N = "companion$module"
145145
val COMPANION_CLASS_METHOD: N = "companion$class"
146+
val BOUNDTYPE_ANNOT: N = "$boundType$"
146147
val QUOTE: N = "'"
147148
val TYPE_QUOTE: N = "type_'"
148149
val TRAIT_SETTER_SEPARATOR: N = str.TRAIT_SETTER_SEPARATOR

0 commit comments

Comments
 (0)