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

Made error message clickable #273

Merged
merged 7 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ case class UseDefMatching(
val useLoc = Locations.get(nodeId)
val defLoc = symbol.getLoc
val defName = symbol.getUnqualifiedName
s"use ${qualifiedName} at ${useLoc.file}: ${useLoc.pos} refers to definition ${defName} at ${defLoc.file}: ${defLoc.pos}"
s"use ${qualifiedName} at ${useLoc.file}:${useLoc.pos} refers to definition ${defName} at ${defLoc.file}:${defLoc.pos}"
}

}
4 changes: 2 additions & 2 deletions compiler/lib/src/main/scala/util/Location.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ final case class Location(
case None => s
case Some(loc) => showIncludes(
loc.includingLoc,
s ++ s"\n included at ${loc.file}: ${loc.pos}"
s ++ s"\n included at ${loc.file}:${loc.pos}"
)
}
}
val s1 = pos match {
case scala.util.parsing.input.NoPosition => s"${file}: end of input"
case _ => s"${file}: ${pos.toString}\n${pos.longString}"
case _ => s"${file}:${pos.toString}\n${pos.longString}"
}
val s2 = showIncludes(includingLoc, "")
s1 ++ s2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/enum_default_error.fpp: 2.25
[ local path prefix ]/compiler/tools/fpp-check/test/array/enum_default_error.fpp:2.25
array A = [3] E default 0
^
error: cannot convert Integer to array A
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_bad_syntax.fpp: 1.26
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_bad_syntax.fpp:1.26
array A = [3] U32 format "{"
^
error: invalid format string:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_float_not_int.fpp: 1.26
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_float_not_int.fpp:1.26
array A = [3] F32 format "{x}"
^
error: invalid format string: F32 is not an integer type
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_int_not_rational.fpp: 1.26
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_int_not_rational.fpp:1.26
array A = [3] U32 format "{.3f}"
^
error: invalid format string: U32 is not a floating-point type
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_missing_repl.fpp: 1.26
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_missing_repl.fpp:1.26
array A = [3] U32 format ""
^
error: invalid format string: missing replacement field
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_not_numeric.fpp: 1.29
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_not_numeric.fpp:1.29
array A = [3] string format "{.3f}"
^
error: invalid format string: string is not a floating-point type
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_precision_too_large.fpp: 1.26
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_precision_too_large.fpp:1.26
array A = [3] F32 format "{.1000f}"
^
error: invalid format string: precision value 1000 is out of range
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_too_many_repls.fpp: 1.26
[ local path prefix ]/compiler/tools/fpp-check/test/array/format_too_many_repls.fpp:1.26
array A = [3] U32 format "{} {} {}"
^
error: invalid format string: too many replacement fields
2 changes: 1 addition & 1 deletion compiler/tools/fpp-check/test/array/invalid_size.ref.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/array/invalid_size.fpp: 1.12
[ local path prefix ]/compiler/tools/fpp-check/test/array/invalid_size.fpp:1.12
array A = [-1] U32
^
error: invalid array size -1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/async_passive.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/async_passive.fpp:3.3
async command C
^
error: passive component may not have async input
2 changes: 1 addition & 1 deletion compiler/tools/fpp-check/test/command/bad_opcode.ref.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/bad_opcode.fpp: 3.26
[ local path prefix ]/compiler/tools/fpp-check/test/command/bad_opcode.fpp:3.26
async command C opcode "abc"
^
error: cannot convert string to a numeric type
2 changes: 1 addition & 1 deletion compiler/tools/fpp-check/test/command/bad_priority.ref.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/bad_priority.fpp: 3.28
[ local path prefix ]/compiler/tools/fpp-check/test/command/bad_priority.fpp:3.28
async command C priority "abc"
^
error: cannot convert string to a numeric type
4 changes: 2 additions & 2 deletions compiler/tools/fpp-check/test/command/duplicate_name.ref.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name.fpp: 4.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name.fpp:4.3
sync command C
^
error: duplicate command name C
previous occurrence is here:
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name.fpp:3.3
async command C
^
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_save.fpp: 5.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_save.fpp:5.3
async command P_PARAM_SAVE
^
error: duplicate command name P_PARAM_SAVE
previous occurrence is here:
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_save.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_save.fpp:3.3
param P: U32
^
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_set.fpp: 5.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_set.fpp:5.3
async command P_PARAM_SET
^
error: duplicate command name P_PARAM_SET
previous occurrence is here:
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_set.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_name_param_set.fpp:3.3
param P: U32
^
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_explicit.fpp: 5.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_explicit.fpp:5.3
sync command C2 opcode 0x10
^
error: duplicate opcode value (16 dec, 10 hex)
previous occurrence is here:
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_explicit.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_explicit.fpp:3.3
sync command C1 opcode 0x10
^
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_implicit.fpp: 7.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_implicit.fpp:7.3
sync command C3
^
error: duplicate opcode value (17 dec, 11 hex)
previous occurrence is here:
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_implicit.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_opcode_implicit.fpp:3.3
sync command C1 opcode 0x11
^
4 changes: 2 additions & 2 deletions compiler/tools/fpp-check/test/command/duplicate_param.ref.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_param.fpp: 3.26
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_param.fpp:3.26
sync command C(a: U32, a: I32)
^
error: duplicate parameter a
previous parameter is here:
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_param.fpp: 3.18
[ local path prefix ]/compiler/tools/fpp-check/test/command/duplicate_param.fpp:3.18
sync command C(a: U32, a: I32)
^
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/missing_ports.fpp: 1.1
[ local path prefix ]/compiler/tools/fpp-check/test/command/missing_ports.fpp:1.1
passive component C {
^
error: component with command specifiers must have command recv port
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/negative_opcode.fpp: 3.26
[ local path prefix ]/compiler/tools/fpp-check/test/command/negative_opcode.fpp:3.26
async command C opcode -1
^
error: invalid integer value -1
Expand Down
2 changes: 1 addition & 1 deletion compiler/tools/fpp-check/test/command/ref_params.ref.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/ref_params.fpp: 3.3
[ local path prefix ]/compiler/tools/fpp-check/test/command/ref_params.fpp:3.3
async command C(ref a: U32)
^
error: command may not have ref parameters
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/sync_priority.fpp: 3.27
[ local path prefix ]/compiler/tools/fpp-check/test/command/sync_priority.fpp:3.27
sync command C priority 10
^
error: only async input may have a priority
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/command/sync_queue_full.fpp: 3.18
[ local path prefix ]/compiler/tools/fpp-check/test/command/sync_queue_full.fpp:3.18
sync command C drop
^
error: only async input may have queue full behavior
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/active_no_async_input.fpp: 1.1
[ local path prefix ]/compiler/tools/fpp-check/test/component/active_no_async_input.fpp:1.1
active component C {
^
error: active component must have async input
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_default_error.fpp: 2.29
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_default_error.fpp:2.29
array A = [3] U32 default "abc"
^
error: cannot convert string to array A
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_format_not_numeric.fpp: 2.24
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_format_not_numeric.fpp:2.24
array A = [3] S format "{.3f}"
^
error: invalid format string: struct S is not a floating-point type
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_undef_constant.fpp: 2.29
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_undef_constant.fpp:2.29
array A = [3] U32 default a
^
error: undefined symbol a
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_undef_type.fpp: 2.17
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_undef_type.fpp:2.17
array A = [3] T
^
error: undefined symbol T
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_default_error.fpp: 2.27
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_default_error.fpp:2.27
enum E { X, Y } default "abc"
^
error: cannot convert string to enum E
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_undef_constant.fpp: 2.16
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_undef_constant.fpp:2.16
enum E { X = a }
^
error: undefined symbol a
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_undef_type.fpp: 2.12
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_undef_type.fpp:2.12
enum E : T { X }
^
error: undefined symbol T
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/queued_no_async_input.fpp: 1.1
[ local path prefix ]/compiler/tools/fpp-check/test/component/queued_no_async_input.fpp:1.1
queued component C {
^
error: queued component must have async input
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_default_error.fpp: 5.13
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_default_error.fpp:5.13
default { x = 0, e = E.X, a = [ 1, 2, 3 ], b = 5 }
^
error: cannot convert { x: Integer, e: enum E, a: [3] Integer, b: Integer } to struct S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_format_not_numeric.fpp: 2.26
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_format_not_numeric.fpp:2.26
struct S2 { x: S1 format "{.3f}" }
^
error: invalid format string: struct S1 is not a floating-point type
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_undef_constant.fpp: 2.37
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_undef_constant.fpp:2.37
struct S { x: U32 } default { x = a }
^
error: undefined symbol a
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_undef_type.fpp: 2.17
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_undef_type.fpp:2.17
struct S { x: T }
^
error: undefined symbol T
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component/undef_constant.fpp: 2.16
[ local path prefix ]/compiler/tools/fpp-check/test/component/undef_constant.fpp:2.16
constant b = a
^
error: undefined symbol a
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fpp-check
error: max ID 256 for instance c1 conflicts with base ID 256 for instance c2
c1 is defined here
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/conflicting_ids.fpp: 12.1
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/conflicting_ids.fpp:12.1
instance c1: C base id 0x100
^
c2 is defined here
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/conflicting_ids.fpp: 13.1
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/conflicting_ids.fpp:13.1
instance c2: C base id 0x100
^
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/invalid_negative_int.fpp: 5.23
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/invalid_negative_int.fpp:5.23
instance c: C base id -1
^
error: invalid integer value -1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_cpu.fpp: 5.33
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_cpu.fpp:5.33
instance c: C base id 0x100 cpu 0
^
error: invalid component instance definition c: passive component may not have CPU affinity
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_priority.fpp: 5.38
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_priority.fpp:5.38
instance c: C base id 0x100 priority 10
^
error: invalid component instance definition c: passive component may not have priority
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_queue_size.fpp: 5.40
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_queue_size.fpp:5.40
instance c: C base id 0x100 queue size 10
^
error: invalid component instance definition c: passive component may not have queue size
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_stack_size.fpp: 5.43
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/passive_stack_size.fpp:5.43
instance c: C base id 0x100 stack size 10 * 1024
^
error: invalid component instance definition c: passive component may not have stack size
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_cpu.fpp: 11.7
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_cpu.fpp:11.7
cpu 0
^
error: invalid component instance definition c: queued component may not have CPU affinity
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_priority.fpp: 11.12
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_priority.fpp:11.12
priority 10
^
error: invalid component instance definition c: queued component may not have priority
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_stack_size.fpp: 11.17
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/queued_stack_size.fpp:11.17
stack size 10 * 1024
^
error: invalid component instance definition c: queued component may not have stack size
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fpp-check
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/undef_component.fpp: 1.13
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/undef_component.fpp:1.13
instance c: C base id 0x100
^
error: undefined symbol C
Loading