Skip to content

Fix #6213: Convert RefinedTypeTrees to TypeTrees in ReTyper #6249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/ReTyper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class ReTyper extends Typer with ReChecking {
override def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): TypeTree =
promote(tree)

override def typedRefinedTypeTree(tree: untpd.RefinedTypeTree)(implicit ctx: Context): TypTree =
promote(TypeTree(tree.tpe).withSpan(tree.span))

override def typedFunPart(fn: untpd.Tree, pt: Type)(implicit ctx: Context): Tree =
typedExpr(fn, pt)

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ class Typer extends Namer
assignType(cpy.SingletonTypeTree(tree)(ref1), ref1)
}

def typedRefinedTypeTree(tree: untpd.RefinedTypeTree)(implicit ctx: Context): RefinedTypeTree = track("typedRefinedTypeTree") {
def typedRefinedTypeTree(tree: untpd.RefinedTypeTree)(implicit ctx: Context): TypTree = track("typedRefinedTypeTree") {
val tpt1 = if (tree.tpt.isEmpty) TypeTree(defn.ObjectType) else typedAheadType(tree.tpt)
val refineClsDef = desugar.refinedTypeToClass(tpt1, tree.refinements).withSpan(tree.span)
val refineCls = createSymbol(refineClsDef).asClass
Expand Down
6 changes: 6 additions & 0 deletions tests/pos/i6213.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object Test {
class C { type T }
inline def foo[U] <: Any = (??? : C { type T = U })

foo[Int]
}