@@ -908,13 +908,11 @@ object Symbols {
908
908
def requiredClassRef (path : PreName )(using Context ): TypeRef = requiredClass(path).typeRef
909
909
910
910
/** 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
918
916
919
917
/** Get a List of ClassSymbols which are either defined in current compilation
920
918
* run or present on classpath.
@@ -923,13 +921,11 @@ object Symbols {
923
921
paths.map(getClassIfDefined).filter(_.exists).map(_.asInstanceOf [ClassSymbol ])
924
922
925
923
/** 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
933
929
934
930
def requiredModule (path : PreName )(using Context ): TermSymbol = {
935
931
val name = path.toTermName
0 commit comments