Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Catch exception from the compiler when coursier api is on cla… #5586

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class CompilerSearchVisitor(
private def isAccessible(sym: Symbol): Boolean = try
sym != NoSymbol && sym.isPublic && sym.isStatic
catch
case err: AssertionError =>
logger.log(Level.WARNING, err.getMessage())
tgodzik marked this conversation as resolved.
Show resolved Hide resolved
false
case NonFatal(e) =>
reports.incognito.create(
Report(
Expand Down Expand Up @@ -65,8 +68,14 @@ class CompilerSearchVisitor(
.stripSuffix("$")
.split("\\$")

val added = toSymbols(pkg, innerPath.toList).filter(visitSymbol)
val added =
try toSymbols(pkg, innerPath.toList).filter(visitSymbol)
catch
case NonFatal(e) =>
logger.log(Level.WARNING, e.getMessage(), e)
Nil
added.size
end visitClassfile

def visitWorkspaceSymbol(
path: java.nio.file.Path,
Expand Down
29 changes: 29 additions & 0 deletions tests/cross/src/test/scala/tests/pc/ShadowingCompletionSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tests.pc

import coursierapi.Dependency
import tests.BaseCompletionSuite

class ShadowingCompletionSuite extends BaseCompletionSuite {

override protected def extraDependencies(
scalaVersion: String
): Seq[Dependency] = Seq(
Dependency.of("io.get-coursier", "interface", "1.0.18")
)

check(
"buffer".tag(IgnoreForScala3CompilerPC),
"""package pkg
|object Main {
| val x = ListBuff@@
|}
|""".stripMargin,
"""|ListBuffer[A](elems: A*): CC[A]
|ListBuffer(i: Int): A
|ListBuffer - scala.collection.mutable
|""".stripMargin,
compat = Map(
"2" -> "ListBuffer - scala.collection.mutable"
),
)
}
Loading