aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-09-04 19:32:13 +0300
committerGitHub <noreply@github.com>2016-09-04 19:32:13 +0300
commita0e7adb070ee9c73c0cca081196198296cbd63ab (patch)
tree955c80e27562ed452f92226f534ead57089db812 /src/dotty/tools/dotc/typer
parent1650add0d7c1f3108fcacd15bb989ebd42234888 (diff)
parent2dfe4db8b3babefeba83eb30ffdc92a5d84665bb (diff)
downloaddotty-a0e7adb070ee9c73c0cca081196198296cbd63ab.tar.gz
dotty-a0e7adb070ee9c73c0cca081196198296cbd63ab.tar.bz2
dotty-a0e7adb070ee9c73c0cca081196198296cbd63ab.zip
Merge pull request #1482 from dotty-staging/fix-asapplicable-safe
More tweaks to type inference
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Inferencing.scala3
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala
index 7c61f8c23..719e8d7fc 100644
--- a/src/dotty/tools/dotc/typer/Inferencing.scala
+++ b/src/dotty/tools/dotc/typer/Inferencing.scala
@@ -78,7 +78,8 @@ object Inferencing {
def apply(x: Boolean, tp: Type): Boolean = tp.dealias match {
case _: WildcardType | _: ProtoType =>
false
- case tvar: TypeVar if !tvar.isInstantiated =>
+ case tvar: TypeVar
+ if !tvar.isInstantiated && ctx.typerState.constraint.contains(tvar) =>
force.appliesTo(tvar) && {
val direction = instDirection(tvar.origin)
if (direction != 0) {
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index f0086b0ab..fdcfe347b 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -895,7 +895,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
def typedSeqLiteral(tree: untpd.SeqLiteral, pt: Type)(implicit ctx: Context): SeqLiteral = track("typedSeqLiteral") {
- val proto1 = pt.elemType orElse WildcardType
+ val proto1 = pt.elemType match {
+ case NoType => WildcardType
+ case bounds: TypeBounds => WildcardType(bounds)
+ case elemtp => elemtp
+ }
val elems1 = tree.elems mapconserve (typed(_, proto1))
val proto2 = // the computed type of the `elemtpt` field
if (!tree.elemtpt.isEmpty) WildcardType