Skip to content

Fix #1868: Fix a logic error in a match #1869

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 2 commits into from
Jan 4, 2017
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: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/ElimByName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransform

def transformArg(arg: Tree, formal: Type): Tree = formal.dealias match {
case formalExpr: ExprType =>
val argType = arg.tpe.widenIfUnstable
var argType = arg.tpe.widenIfUnstable
if (defn.isBottomType(argType)) argType = formal.widenExpr
val argFun = arg match {
case Apply(Select(qual, nme.apply), Nil)
if qual.tpe.derivesFrom(defn.FunctionClass(0)) && isPureExpr(qual) =>
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 @@ -1150,7 +1150,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
// classes defined in a such arguments should not be entered into the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're at it, you could fix the typo here: "in a such" -> "in such"

// enclosing class.
c.exprContext(mdef, exprOwner)
case None => c
case _ => c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a perfect example of why we shouldn't turn off exhaustiveness warnings when guards are used ;) (cf: scala/scala#5617)

}
}
// necessary in order to mark the typed ahead annotations as definitely typed:
Expand Down
7 changes: 7 additions & 0 deletions tests/pos/i1868.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Test[X](x: X) {
def checkSpecialization[Y](y: Y): X = {
def specMe[@specialized T]() = ()
x
}
private def checkNameStartsWith(prefix: String) = { (new Exception) }
}