Skip to content

Commit 93ef850

Browse files
Do not reset the GivenOrImplicit flags on implicits without explicit types
Also fix a neg test for i3067. After this modification to the completion algorithm, implicit definitions without explicit types stay visible in the implicit scope and hence, the error of the missing implicit is not reporter. This is fine, however, since the real error to be fixed is the lack of an explicit type of the implicit value, not the lack of the implicit value itself.
1 parent 4c76176 commit 93ef850

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,8 @@ class Namer { typer: Typer =>
746746
else bound
747747
}
748748

749-
def missingType(sym: Symbol, modifier: String)(implicit ctx: Context): Unit = {
749+
def missingType(sym: Symbol, modifier: String)(implicit ctx: Context): Unit =
750750
ctx.error(s"${modifier}type of implicit definition needs to be given explicitly", sym.sourcePos)
751-
sym.resetFlag(GivenOrImplicit)
752-
}
753751

754752
/** The completer of a symbol defined by a member def or import (except ClassSymbols) */
755753
class Completer(val original: Tree)(implicit ctx: Context) extends LazyType with SymbolLoaders.SecondCompleter {

tests/neg/i3067.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ object o {
1010

1111
implicit def y = "abc" // error
1212

13-
implicit object a extends Test(_ map identity) // error // error: no implicit argument found
13+
implicit object a extends Test(_ map identity) // error
1414
implicit object b extends Test(_ map identity) // error // error: cyclic reference
1515
}

0 commit comments

Comments
 (0)