aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala3
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
3 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index aa2227d63..2c1384524 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -562,7 +562,7 @@ trait Applications extends Compatibility { self: Typer =>
ttree.tpe match {
case alias: TypeRef if alias.symbol.isAliasType =>
companionRef(alias) match {
- case companion: TermRef => return untpd.ref(companion)
+ case companion: TermRef => return untpd.ref(companion) withPos tree.pos
case _ =>
}
case _ =>
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 3878e5235..de74917a8 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -245,7 +245,8 @@ trait Implicits { self: Typer =>
!from.isError
&& !to.isError
&& (ctx.mode is Mode.ImplicitsEnabled)
- && (inferView(dummyTreeOfType(from), to).isInstanceOf[SearchSuccess]))
+ && (inferView(dummyTreeOfType(from), to)(ctx.fresh.withExploreTyperState).isInstanceOf[SearchSuccess])
+ )
/** Find an implicit conversion to apply to given tree `from` so that the
* result is compatible with type `to`.
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 85724b1ee..be84d1bea 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -492,7 +492,7 @@ class Typer extends Namer with Applications with Implicits {
def typedIf(tree: untpd.If, pt: Type)(implicit ctx: Context) = track("typedIf") {
val cond1 = typed(tree.cond, defn.BooleanType)
val thenp1 = typed(tree.thenp, pt)
- val elsep1 = typed(tree.elsep orElse untpd.unitLiteral, pt)
+ val elsep1 = typed(tree.elsep orElse untpd.unitLiteral withPos tree.pos, pt)
cpy.If(tree, cond1, thenp1, elsep1).withType(thenp1.tpe | elsep1.tpe)
}
@@ -952,6 +952,7 @@ class Typer extends Namer with Applications with Implicits {
}
def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = ctx.traceIndented (s"typing ${tree.show}", show = true) {
+ if (!tree.isEmpty && ctx.typerState.isGlobalCommittable) assert(tree.pos.exists, tree)
try adapt(typedUnadapted(tree, pt), pt)
catch {
case ex: CyclicReference => errorTree(tree, cyclicErrorMsg(ex))