@@ -908,13 +908,11 @@ object Symbols {
908908 def requiredClassRef (path : PreName )(using Context ): TypeRef = requiredClass(path).typeRef
909909
910910 /** Get ClassSymbol if class is either defined in current compilation run
911- * or present on classpath.
912- * Returns NoSymbol otherwise. */
913- def getClassIfDefined (path : PreName )(using Context ): Symbol = {
914- val name = path.toTypeName
915- staticRef(name, generateStubs = false )
916- .requiredSymbol(" class" , name, generateStubs = false )(_.isClass)
917- }
911+ * or present on classpath. Returns NoSymbol otherwise.
912+ */
913+ def getClassIfDefined (path : PreName )(using Context ): Symbol =
914+ staticRef(path.toTypeName, generateStubs = false )
915+ .disambiguate(_.isClass).symbol
918916
919917 /** Get a List of ClassSymbols which are either defined in current compilation
920918 * run or present on classpath.
@@ -923,13 +921,11 @@ object Symbols {
923921 paths.map(getClassIfDefined).filter(_.exists).map(_.asInstanceOf [ClassSymbol ])
924922
925923 /** Get ClassSymbol if package is either defined in current compilation run
926- * or present on classpath.
927- * Returns NoSymbol otherwise. */
928- def getPackageClassIfDefined (path : PreName )(using Context ): Symbol = {
929- val name = path.toTypeName
930- staticRef(name, isPackage = true , generateStubs = false )
931- .requiredSymbol(" package" , name, generateStubs = false )(_ is PackageClass )
932- }
924+ * or present on classpath. Returns NoSymbol otherwise.
925+ */
926+ def getPackageClassIfDefined (path : PreName )(using Context ): Symbol =
927+ staticRef(path.toTypeName, isPackage = true , generateStubs = false )
928+ .disambiguate(_ is PackageClass ).symbol
933929
934930 def requiredModule (path : PreName )(using Context ): TermSymbol = {
935931 val name = path.toTermName
0 commit comments