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
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1202,8 +1202,9 @@ object RefChecks {
/** Check that public (and protected) methods/fields do not expose flexible types. */
def checkPublicFlexibleTypes(sym: Symbol)(using Context): Unit =
if ctx.explicitNulls && !ctx.isJava
&& sym.exists && !sym.is(Private) && sym.owner.isClass
&& !sym.isOneOf(Synthetic | InlineProxy | Param | Exported) then
&& sym.exists && sym.owner.isClass
&& !sym.owner.isAnonymousClass
&& !sym.isOneOf(JavaOrPrivateOrSynthetic | InlineProxy | Param | Exported) then
val resTp = sym.info.finalResultType
if resTp.existsPart(_.isInstanceOf[FlexibleType], StopAt.Static) then
report.warning(
Expand Down
17 changes: 17 additions & 0 deletions tests/explicit-nulls/pos/i24440.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//> using options -Yexplicit-nulls -Werror

trait AwtComponentLogging extends java.awt.Component:

override def getPreferredSize: java.awt.Dimension =
val dim: java.awt.Dimension = super.getPreferredSize
dim

private def superPS1 = super.getPreferredSize

private val superPS2 = super.getPreferredSize

class Test:
def getCompoment: java.awt.Component =
new java.awt.Component {
override def getPreferredSize = super.getPreferredSize
}
Loading