diff --git a/semantic/src/main/kotlin/tools/samt/semantic/ConstraintBuilder.kt b/semantic/src/main/kotlin/tools/samt/semantic/ConstraintBuilder.kt index d55b35cf..0bda554c 100644 --- a/semantic/src/main/kotlin/tools/samt/semantic/ConstraintBuilder.kt +++ b/semantic/src/main/kotlin/tools/samt/semantic/ConstraintBuilder.kt @@ -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 diff --git a/semantic/src/test/kotlin/tools/samt/semantic/SemanticModelTest.kt b/semantic/src/test/kotlin/tools/samt/semantic/SemanticModelTest.kt index 1a31c8da..2baf6e80 100644 --- a/semantic/src/test/kotlin/tools/samt/semantic/SemanticModelTest.kt +++ b/semantic/src/test/kotlin/tools/samt/semantic/SemanticModelTest.kt @@ -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" + + " ^'" ) ) } diff --git a/specification/examples/debug/debug.samt b/specification/examples/debug/debug.samt new file mode 100644 index 00000000..3b739358 --- /dev/null +++ b/specification/examples/debug/debug.samt @@ -0,0 +1,5 @@ +package debug.test + +record Foo { + name: String ("++") +} \ No newline at end of file diff --git a/specification/examples/debug/samt.yaml b/specification/examples/debug/samt.yaml new file mode 100644 index 00000000..96a38136 --- /dev/null +++ b/specification/examples/debug/samt.yaml @@ -0,0 +1,5 @@ +source: ./ + +generators: + - name: kotlin-ktor-consumer + output: ./out