Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit 2f7fa06

Browse files
committed
And some more regexp adjustements
1 parent bd11cb6 commit 2f7fa06

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

model/src/main/scala/com/softwaremill/clippy/CompilationErrorParser.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.softwaremill.clippy
33
import java.util.regex.Pattern
44

55
object CompilationErrorParser {
6-
private val FoundRegexp = """found\s*:\s*([^\n]+)\n""".r
6+
private val FoundRegexp = """found\s*:\s*([^\n]+)""".r
77
private val RequiredPrefixRegexp = """required\s*:""".r
88
private val AfterRequiredRegexp = """required\s*:\s*([^\n]+)""".r
99
private val WhichExpandsToRegexp = """\s*\(which expands to\)\s*([^\n]+)""".r
@@ -13,7 +13,7 @@ object CompilationErrorParser {
1313
private val ImplicitNotFoundRegexp = """could not find implicit value for parameter\s*([^:]+):\s*([^\n]+)""".r
1414
private val DivergingImplicitExpansionRegexp = """diverging implicit expansion for type\s*([^\s]+)\s*.*\s*starting with method\s*([^\s]+)\s*in\s*([^\n]+)""".r
1515
private val TypeArgumentsDoNotConformToOverloadedBoundsRegexp = """type arguments \[([^\]]+)\] conform to the bounds of none of the overloaded alternatives of\s*([^:\n]+)[^:]*: ([^\n]+)""".r
16-
private val TypeclassNotFoundRegexp = """No implicit (.*) defined for (.*).\n""".r
16+
private val TypeclassNotFoundRegexp = """No implicit (.*) defined for ([^\n]+)""".r
1717

1818
def parse(e: String): Option[CompilationError[ExactT]] = {
1919
val error = e.replaceAll(Pattern.quote("[error]"), "")
@@ -62,7 +62,8 @@ object CompilationErrorParser {
6262
else if (error.contains("No implicit")) {
6363
for {
6464
inf <- TypeclassNotFoundRegexp.findFirstMatchIn(error)
65-
} yield TypeclassNotFoundError(ExactT(inf.group(1)), ExactT(inf.group(2)))
65+
group2 = inf.group(2)
66+
} yield TypeclassNotFoundError(ExactT(inf.group(1)), ExactT(if (group2.endsWith(".")) group2.substring(0, group2.length-1) else group2))
6667
}
6768
else None
6869
}

0 commit comments

Comments
 (0)