import opts
import location
-private class Message
+class Message
+special Comparable
+ redef type OTHER: Message
+
readable attr _location: nullable Location
readable attr _text: String
+
+ redef fun <(other: OTHER): Bool do
+ if location == null then return true
+ if other.location == null then return false
+
+ return location.as(not null) < other.location.as(not null)
+ end
end
# Global context for tools
# Messages
var _messages: Array[Message] = new Array[Message]
+ var _message_sorter: ComparableSorter[Message] = new ComparableSorter[Message]
fun check_errors
do
if _messages.length > 0 then
+ _message_sorter.sort(_messages)
+
for m in _messages do
stderr.write("{m.text}\n")
end
-./error_type_not_ok3.nit:23,18--21: Type error: class Fail not found in module error_type_not_ok3.
./error_type_not_ok3.nit:20,12--15: Type error: class Fail not found in module error_type_not_ok3.
+./error_type_not_ok3.nit:23,18--21: Type error: class Fail not found in module error_type_not_ok3.
+./error_type_not_ok4.nit:21,10--13: Type error: class Fail not found in module error_type_not_ok4.
./error_type_not_ok4.nit:25,16--19: Type error: class Fail not found in module error_type_not_ok4.
./error_type_not_ok4.nit:29,28--31: Type error: class Fail not found in module error_type_not_ok4.
./error_type_not_ok4.nit:30,12--15: Type error: class Fail not found in module error_type_not_ok4.
./error_type_not_ok4.nit:31,18--21: Type error: class Fail not found in module error_type_not_ok4.
./error_type_not_ok4.nit:32,10--13: Type error: class Fail not found in module error_type_not_ok4.
./error_type_not_ok4.nit:33,16--19: Type error: class Fail not found in module error_type_not_ok4.
-./error_type_not_ok4.nit:21,10--13: Type error: class Fail not found in module error_type_not_ok4.