Skip to content

Commit 8a37267

Browse files
committed
Drop staticOnly paraaeter
1 parent f40e55c commit 8a37267

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

compiler/src/dotty/tools/dotc/config/Platform.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import core.Contexts._, core.Symbols._
77
import core.SymbolLoader
88
import core.SymDenotations.SymDenotation
99
import core.StdNames.nme
10+
import core.Flags.Module
1011

1112
/** The platform dependent pieces of Global.
1213
*/
@@ -36,12 +37,10 @@ abstract class Platform {
3637
/** The given symbol is a method with the right name and signature to be a runnable program. */
3738
def isMainMethod(sym: SymDenotation)(implicit ctx: Context): Boolean
3839

39-
/** The given class has a main method.
40-
* @param staticOnly only static main methods count
41-
*/
42-
final def hasMainMethod(sym: Symbol, staticOnly: Boolean = false)(implicit ctx: Context): Boolean =
40+
/** The given class has a main method. */
41+
final def hasMainMethod(sym: Symbol)(implicit ctx: Context): Boolean =
4342
sym.info.member(nme.main).hasAltWith {
44-
case x: SymDenotation => isMainMethod(x) && (!staticOnly || x.isStatic)
43+
case x: SymDenotation => isMainMethod(x) && (sym.is(Module) || x.isStatic)
4544
case _ => false
4645
}
4746
}

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
230230

231231
allNonLocalClassesInSrc += cl
232232

233-
if (sym.isStatic && !sym.is(Trait) &&
234-
ctx.platform.hasMainMethod(sym, staticOnly = !sym.is(Module))) {
233+
if (sym.isStatic && !sym.is(Trait) && ctx.platform.hasMainMethod(sym)) {
235234
// If sym is an object, all main methods count, otherwise only @static ones count.
236235
_mainClasses += name
237236
}

0 commit comments

Comments
 (0)