Skip to content
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
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3140,7 +3140,9 @@ class Typer extends Namer
if (isFullyDefined(wtp, force = ForceDegree.all) &&
ctx.typerState.constraint.ne(prevConstraint)) readapt(tree)
else err.typeMismatch(tree, pt, failure)
if (ctx.mode.is(Mode.ImplicitsEnabled) && tree.typeOpt.isValueType)
if ctx.mode.is(Mode.ImplicitsEnabled) && tree.typeOpt.isValueType then
if pt.isRef(defn.AnyValClass) || pt.isRef(defn.ObjectClass) then
ctx.error(em"the result of an implicit conversion must be more specific than $pt", tree.sourcePos)
inferView(tree, pt) match {
case SearchSuccess(found: ExtMethodApply, _, _) =>
found // nothing to check or adapt for extension method applications
Expand Down
4 changes: 4 additions & 0 deletions tests/neg/i6336.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Test {
val a: AnyVal = "foo" // error
val b: AnyRef = 1 // error
}
3 changes: 0 additions & 3 deletions tests/pos/implicit-anyval-2.10.scala

This file was deleted.