File tree 1 file changed +12
-2
lines changed
shared/src/main/scala/io/kaitai/struct/format
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -253,9 +253,19 @@ object ClassSpec {
253
253
private def checkDupId (prevAttrOpt : Option [MemberSpec ], id : String , nowAttr : YAMLPath ): Unit = {
254
254
prevAttrOpt match {
255
255
case Some (prevAttr) =>
256
+ // Report error at position where referenced param / attribute / instance is defined.
257
+ // Add `id` for attributes in `seq` and `params`, do not add for instances
258
+ val path = nowAttr match {
259
+ case _ : InstanceSpec => nowAttr.path
260
+ case _ => nowAttr.path :+ " id"
261
+ }
262
+ val prevPath = prevAttr match {
263
+ case _ : InstanceSpec => prevAttr.path
264
+ case _ => prevAttr.path :+ " id"
265
+ }
256
266
throw KSYParseError .withText(
257
- s " duplicate attribute ID ' $id', previously defined at / ${prevAttr.pathStr }" ,
258
- nowAttr. path
267
+ s " duplicate attribute ID ' $id', previously defined at / ${prevPath.mkString( " / " ) }" ,
268
+ path
259
269
)
260
270
case None =>
261
271
// no dups, ok
You can’t perform that action at this time.
0 commit comments