Skip to content

Commit d5058af

Browse files
committed
Harden IDE: Survive duplicate package and object
1 parent bf201c3 commit d5058af

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ object SymbolLoaders {
7070
// offer a setting to resolve the conflict one way or the other.
7171
// This was motivated by the desire to use YourKit probes, which
7272
// require yjp.jar at runtime. See SI-2089.
73-
if (ctx.settings.YtermConflict.isDefault)
74-
throw new TypeError(
75-
i"""$owner contains object and package with same name: $pname
76-
|one of them needs to be removed from classpath""")
77-
else if (ctx.settings.YtermConflict.value == "package") {
73+
if (ctx.settings.YtermConflict.value == "package" || ctx.mode.is(Mode.Interactive)) {
7874
ctx.warning(
7975
s"Resolving package/object name conflict in favor of package ${preExisting.fullName}. The object will be inaccessible.")
8076
owner.asClass.delete(preExisting)
81-
} else {
77+
} else if (ctx.settings.YtermConflict.value == "object") {
8278
ctx.warning(
8379
s"Resolving package/object name conflict in favor of object ${preExisting.fullName}. The package will be inaccessible.")
8480
return NoSymbol
8581
}
82+
else
83+
throw new TypeError(
84+
i"""$owner contains object and package with same name: $pname
85+
|one of them needs to be removed from classpath""")
8686
}
8787
ctx.newModuleSymbol(owner, pname, PackageCreationFlags, PackageCreationFlags,
8888
completer).entered

0 commit comments

Comments
 (0)