Skip to content

Commit

Permalink
feat(diagnostic): Show regex error message
Browse files Browse the repository at this point in the history
  • Loading branch information
KCreate committed Jun 1, 2023
1 parent 0aff6a5 commit cd189fa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal class ConstraintBuilder(private val controller: DiagnosticController) {

try { Regex(pattern) } catch (e: Exception) {
argument.reportError(controller) {
message("Invalid regex pattern")
message("Invalid regex pattern: '${e.message}'")
highlight(argument.location)
}
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ class SemanticModelTest {
""".trimIndent()
parseAndCheck(
source to listOf(
"Error: Invalid regex pattern"
"Error: Invalid regex pattern: 'Dangling meta character '+' near index 5\n" +
"fo/+++!hi\n" +
" ^'"
)
)
}
Expand Down
5 changes: 5 additions & 0 deletions specification/examples/debug/debug.samt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package debug.test

record Foo {
name: String ("++")
}
5 changes: 5 additions & 0 deletions specification/examples/debug/samt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source: ./

generators:
- name: kotlin-ktor-consumer
output: ./out

0 comments on commit cd189fa

Please sign in to comment.