Skip to content

Refine infoDependsOnPrefix #18204

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
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Make constructors effectively final
This is mainly a cleanup.
  • Loading branch information
odersky committed Jul 13, 2023
commit 0d4ca15e74ca25a9702fe056e5592deac9e2d03c
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ object SymDenotations {
isOneOf(EffectivelyFinalFlags)
|| is(Inline, butNot = Deferred)
|| is(JavaDefinedVal, butNot = Method)
|| isConstructor
|| !owner.isExtensibleClass

/** A class is effectively sealed if has the `final` or `sealed` modifier, or it
Expand Down
6 changes: 2 additions & 4 deletions compiler/src/dotty/tools/dotc/transform/init/Util.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ object Util:
case _ =>
None

def resolve(cls: ClassSymbol, sym: Symbol)(using Context): Symbol = log("resove " + cls + ", " + sym, printer, (_: Symbol).show) {
if (sym.isEffectivelyFinal || sym.isConstructor) sym
def resolve(cls: ClassSymbol, sym: Symbol)(using Context): Symbol = log("resove " + cls + ", " + sym, printer, (_: Symbol).show):
if sym.isEffectivelyFinal then sym
else sym.matchingMember(cls.appliedRef)
}


extension (sym: Symbol)
def hasSource(using Context): Boolean = !sym.defTree.isEmpty
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ class RefChecks extends MiniPhase { thisPhase =>
// if (settings.warnNullaryUnit)
// checkNullaryMethodReturnType(sym)
// if (settings.warnInaccessible) {
// if (!sym.isConstructor && !sym.isEffectivelyFinal && !sym.isSynthetic)
// if (!sym.isEffectivelyFinal && !sym.isSynthetic)
// checkAccessibilityOfReferencedTypes(tree)
// }
// tree match {
Expand Down