-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid creating a secondary message of higher importance
When having multiple messages at the same location we are aggregating them into a primary and secondaries. In some cases, the primary message can be a warning and one of the secondary will be an error unrelated to the warning. In this case, create a new primary message for visibility purpose. Add a test. For eng/ide/gnatstudio#266
- Loading branch information
1 parent
0c3586a
commit 26d15d7
Showing
7 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
testsuite/tests/gs.266.message_secondary_with_higher_importance/obsolescent.gpr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
project Obsolescent is | ||
|
||
for Source_Dirs use ("src"); | ||
|
||
package Builder is | ||
for Default_Switches ("Ada") use ("-gnatwj", "-f"); | ||
end Builder; | ||
end Obsolescent; |
6 changes: 6 additions & 0 deletions
6
testsuite/tests/gs.266.message_secondary_with_higher_importance/src/foo.adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
with Pack; | ||
|
||
procedure Foo is | ||
begin | ||
Pack.Obs (1, 2, 3); | ||
end Foo; |
26 changes: 26 additions & 0 deletions
26
testsuite/tests/gs.266.message_secondary_with_higher_importance/src/pack.adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
with Ada.Text_IO; | ||
|
||
package body Pack is | ||
|
||
--------- | ||
-- Obs -- | ||
--------- | ||
|
||
procedure Obs (I, J, K, L : Integer) is | ||
pragma Unreferenced (L); | ||
begin | ||
Real (I, J, K); | ||
end Obs; | ||
|
||
---------- | ||
-- Real -- | ||
---------- | ||
|
||
procedure Real (I, J, K : Integer) is | ||
begin | ||
if I = J and then K = I + J then | ||
Ada.Text_IO.Put_Line ("Hello World"); | ||
end if; | ||
end Real; | ||
|
||
end Pack; |
8 changes: 8 additions & 0 deletions
8
testsuite/tests/gs.266.message_secondary_with_higher_importance/src/pack.ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package Pack is | ||
|
||
procedure Obs (I, J, K, L : Integer); | ||
pragma Obsolescent (Obs, "Use Real"); | ||
|
||
procedure Real (I, J, K : Integer); | ||
|
||
end Pack; |
31 changes: 31 additions & 0 deletions
31
testsuite/tests/gs.266.message_secondary_with_higher_importance/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Verify that when multiple messages are located in the same location, | ||
the highest message will be a primary. | ||
""" | ||
import GPS | ||
from gs_utils.internal.utils import * | ||
|
||
EXPECTED = ['Builder results (2 items in 1 file)', | ||
['foo.adb (2 items)', | ||
['<b>5:8</b> warning: call to obsolescent procedure' + | ||
' "Obs" declared at pack.ads:3 [enabled by default]', | ||
[' warning: call to obsolescent procedure' + | ||
' "Obs" declared at <span color="#729FCF">' + | ||
'<u>pack.ads:3</u></span> [enabled by default]', | ||
' warning: Use Real [enabled by default]'], | ||
'<b>5:8</b> error: missing argument for parameter' + | ||
' "L" in call to "Obs"' + | ||
' declared at pack.ads:3', | ||
[' error: missing argument for parameter "' + | ||
'L" in call to "Obs" declared at' + | ||
' <span color="#729FCF"><u>pack.ads:3</u></span>']]]] | ||
|
||
|
||
@run_test_driver | ||
def driver(): | ||
GPS.BuildTarget("Build All").execute(force=True) | ||
yield wait_tasks() | ||
|
||
gps_assert(dump_locations_tree(), | ||
EXPECTED, | ||
"Missing error for first renaming") |
1 change: 1 addition & 0 deletions
1
testsuite/tests/gs.266.message_secondary_with_higher_importance/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
title: 'gs.266.message_secondary_with_higher_importance' |