aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-11-04 15:19:41 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-11-22 20:10:22 +0100
commit32954ba55955f4335bb34007269e3d405faa1780 (patch)
tree4410a4a406fd5dceb97a74b3a1df78bc0d4d8c5c /src/dotty/tools/dotc/core/pickling
parentcc8ca00fc1718bcbb49e3c61f3c0682eac2a7e7c (diff)
downloaddotty-32954ba55955f4335bb34007269e3d405faa1780.tar.gz
dotty-32954ba55955f4335bb34007269e3d405faa1780.tar.bz2
dotty-32954ba55955f4335bb34007269e3d405faa1780.zip
Extracting ApplyOverloaded to be reused in UnPickler and ClassfileParser
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling')
-rw-r--r--src/dotty/tools/dotc/core/pickling/ClassfileParser.scala2
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala18
2 files changed, 4 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
index fb5a6309b..8bf84e1a9 100644
--- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
@@ -444,7 +444,7 @@ class ClassfileParser(
}
}
if (hasError || skip) None
- else Some(Annotation.deferred(attrType, argbuf.toList))
+ else Some(Annotation.deferredResolve(attrType, argbuf.toList))
} catch {
case f: FatalError => throw f // don't eat fatal errors, they mean a class was not found
case ex: Throwable =>
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index c503f447b..728048700 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -832,22 +832,10 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot:
t.toList
}
// println(atp)
- val typer = ctx.typer
- val proto = new FunProtoTyped(args, atp, typer)
- val alts = atp.member(nme.CONSTRUCTOR).alternatives.map(_.termRef)
-
- val constructors = ctx.typer.resolveOverloaded(alts, proto, Nil)
- assert(constructors.size == 1) // this is parsed from bytecode tree. there's nothing user can do about it
-
- val constr = constructors.head
val targs = atp.argTypes
- val fun = tpd.New(atp withoutArgs targs)
- .select(TermRef.withSig(atp.normalizedPrefix, constr.termSymbol.asTerm))
- .appliedToTypes(targs)
- val apply = untpd.Apply(fun, args)
- new typer.ApplyToTyped(apply, fun, constr, args, atp).result.asInstanceOf[tpd.Tree] // needed to handle varargs
- // Dotty deviation, for scalac the last cast wouldn't be required
- }
+
+ tpd.applyOverloaded(tpd.New(atp withoutArgs targs), nme.CONSTRUCTOR, args, targs, atp)
+}
/** Read an annotation and as a side effect store it into
* the symbol it requests. Called at top-level, for all