-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add split-init error when uninitialized var used as actual (#26497)
This adds detection of an uninitialized variable used as an actual to a non-out formal. The previous error was a generic failure to resolve function [NoMatchingCandidates] and this improves the message by indicating that the candidate did not match because of the uninitialized actual passed to a non-out formal. resolves Cray/chapel-private#6624 TESTING: - [x] paratest `[Summary: #Successes = 17721 | #Failures = 0 | #Futures = 904]` - [x] gasnet paratest `[Summary: #Successes = 17906 | #Failures = 0 | #Futures = 915]` [reviewed by @DanilaFe - thank you!]
- Loading branch information
Showing
8 changed files
with
191 additions
and
33 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
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
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
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
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
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,5 @@ | ||
noMatchingCandidates.chpl:6: error: unable to resolve call to 'fn': no matching candidates | ||
noMatchingCandidates.chpl:2: note: the following candidate didn't match because an actual couldn't be passed to a formal | ||
noMatchingCandidates.chpl:6: note: The actual 'x' expects to be split-initialized because it is declared without a type or initialization expression here | ||
noMatchingCandidates.chpl:14: error: unable to resolve call to 'fn': no matching candidates | ||
noMatchingCandidates.chpl:10: note: the following candidate didn't match because an actual couldn't be passed to a formal |
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,45 @@ | ||
─── error in noMatchingCandidates.chpl:6 [NoMatchingCandidates] ─── | ||
Unable to resolve call to 'fn': no matching candidates. | ||
| | ||
6 | fn(x); | ||
| | ||
|
||
The following candidate didn't match because an actual couldn't be passed to a formal: | ||
| | ||
2 | proc fn(const arg) { | ||
| ⎺⎺⎺⎺⎺⎺⎺⎺⎺ | ||
3 | arg; | ||
4 | } | ||
| | ||
The actual 'x' expects to be split-initialized because it is declared without a type or initialization expression here: | ||
| | ||
5 | var x; | ||
| ⎺ | ||
| | ||
The call to 'fn' occurs before any valid initialization points: | ||
| | ||
6 | fn(x); | ||
| ⎺ | ||
| | ||
The call to 'fn' cannot initialize 'x' because only 'out' formals can be used to split-initialize. However, 'x' is passed to formal 'arg' which has intent 'const'. | ||
|
||
─── error in noMatchingCandidates.chpl:14 [NoMatchingCandidates] ─── | ||
Unable to resolve call to 'fn': no matching candidates. | ||
| | ||
14 | fn(x); | ||
| | ||
|
||
The following candidate didn't match because an actual couldn't be passed to a formal: | ||
| | ||
10 | proc fn(arg:string) { | ||
| ⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺ | ||
11 | arg; | ||
12 | } | ||
| | ||
The formal 'arg' expects a value of type 'string', but the actual was a value of type 'int(64)'. | ||
| | ||
14 | fn(x); | ||
| ⎺ | ||
| | ||
Formals with kind 'const ref' expect the actual to be a subtype, but 'int(64)' is not a subtype of 'string'. | ||
|
Oops, something went wrong.