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

Add a workaround: Surface.of[A] throws InternalError on REPL #308

Merged
merged 2 commits into from
Nov 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,21 @@ class GenericSurface(
override val objectFactory: Option[ObjectFactory] = None
) extends Surface {

private def getClassName: String = {
try {
rawType.getSimpleName
} catch {
case e: InternalError =>
// Scala REPL use class name like $line3.$read$$iw$$iw$A, which causes InternalError at getSimpleName
rawType.getName
}
}

def name: String = {
if (typeArgs.isEmpty) {
rawType.getSimpleName
getClassName
} else {
s"${rawType.getSimpleName}[${typeArgs.map(_.name).mkString(",")}]"
s"${getClassName}[${typeArgs.map(_.name).mkString(",")}]"
}
}

Expand Down