diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 18e2d234452d..c1545dadf46e 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -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""" diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index b7c65a30e7b4..46589d2fe0a2 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -473,8 +473,6 @@ 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)) if sym.isType && (!sym.isClass || sym.is(Trait)) then fail(TypesAndTraitsCantBeImplicit()) }