File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import core.Contexts._, core.Symbols._
77import core .SymbolLoader
88import core .SymDenotations .SymDenotation
99import 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}
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments