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
7 changes: 0 additions & 7 deletions compiler/src/dotty/tools/dotc/reporting/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1510,13 +1510,6 @@ import transform.SymUtils._
def explain = ""
}

class TopLevelCantBeImplicit(sym: Symbol)(
implicit ctx: Context)
extends SyntaxMsg(TopLevelCantBeImplicitID) {
def msg = em"""${hl("implicit")} modifier cannot be used for top-level definitions"""
def explain = ""
}

class TypesAndTraitsCantBeImplicit()(using Context)
extends SyntaxMsg(TypesAndTraitsCantBeImplicitID) {
def msg = em"""${hl("implicit")} modifier cannot be used for types or traits"""
Expand Down
3 changes: 1 addition & 2 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,7 @@ object Checking {
if sym.isInlineMethod && !sym.is(Deferred) && sym.allOverriddenSymbols.nonEmpty then
checkInlineOverrideParameters(sym)
if (sym.is(Implicit)) {
if (sym.owner.is(Package))
fail(TopLevelCantBeImplicit(sym))
assert(!sym.owner.is(Package), s"top-level implicit $sym should be wrapped by a package after typer")
if sym.isType && (!sym.isClass || sym.is(Trait)) then
fail(TypesAndTraitsCantBeImplicit())
}
Expand Down