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

Weird Compilation Error while generating docs for class with scala-logging #55

Open
saveveltri opened this issue Mar 20, 2018 · 0 comments

Comments

@saveveltri
Copy link

saveveltri commented Mar 20, 2018

Hello,

I'm encountering this strange behaviour while executing sbt unidoc in a module of my project which has got simple ADTs and only com.typesafe.scala-logging" %% "scala-logging" % "3.7.2 as a dependency.

Here is an example

sealed trait Statement {
  def db: String
}

case class SelectStatement(override val db: String)
    extends SQLStatement
    with LazyLogging {

  private def filterToExpression(dimension: String, operator: String, value:String): Option[Expression] = {
    operator match {
      case ">"         => Some(ComparisonExpression(dimension, GreaterThanOperator, value))
      case ">="        => Some(ComparisonExpression(dimension, GreaterOrEqualToOperator, value))
      case "="         => Some(EqualityExpression(dimension, value))
      case "<="        => Some(ComparisonExpression(dimension, LessOrEqualToOperator, value))
      case "<"         => Some(ComparisonExpression(dimension, LessThanOperator, value))
      case op @ _      =>
        logger.warn("Ignored filter with invalid operator: {}", op)
        None
    }
  }

scala version is 2.12.4

The exception got is

[error] 
[error]   last tree to typer: Ident(op)
[error]               symbol: value op (flags: <triedcooking>)
[error]    symbol definition: val op: String
[error]                  tpe: String
[error]        symbol owners: value op -> method filterToExpression -> class SelectSQLStatement -> package statement
[error]       context owners: method filterToExpression -> class SelectSQLStatement -> package statement
[error] 
[error] == Enclosing template or block ==
[error] 
[error] Block(
[error]   Apply(
[error]     "logger"."warn"
[error]     // 2 arguments
[error]     "Ignored filter with invalid operator: {}"
[error]     "op" // val op: String, tree.tpe=String
[error]   )
[error]   "None"
[error] )
[error] 
[error] == Expanded type of tree ==
[error] 
[error] TypeRef(
[error]   TypeSymbol(
[error]     final class String extends Serializable with Comparable[String] with CharSequence
[error]     
[error]   )
[error] )
[error] 
[error] uncaught exception during compilation: scala.MatchError

Honestly, I have no clue of what can cause such a low level exception.
Any hint or suggestion is much apprecciated.

Thanks for the support,
Saverio

@saveveltri saveveltri changed the title Weird Compilation Error while generating class with scala-logging Weird Compilation Error while generating docs for class with scala-logging Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant