From 2fffa023502cbaffe0e282495e18aefe2bff0d22 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 9 Aug 2013 17:53:20 +0200 Subject: Typing of SeqLiterals Also revised handling of SeqLiterals by replacing additional type member with split into SeqLiteral and JavaSeqLiteral. --- src/dotty/tools/dotc/typer/Typer.scala | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 5712dddcb..7995da312 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -533,6 +533,12 @@ class Typer extends Namer with Applications with Implicits { cpy.Throw(tree, expr1) withType defn.NothingType } + def typedSeqLiteral(tree: untpd.SeqLiteral, pt: Type)(implicit ctx: Context): SeqLiteral = { + val proto1 = pt.elemType orElse WildcardType + val elems1 = tree.elems map (typed(_, proto1)) + cpy.SeqLiteral(tree, elems1) withType ctx.lub(elems1.tpes) + } + def typedBind(tree: untpd.Bind, pt: Type)(implicit ctx: Context): Bind = { val body1 = typed(tree.body, pt) val sym = ctx.newSymbol(ctx.owner, tree.name.asTermName, EmptyFlags, pt, coord = tree.pos) -- cgit v1.2.3