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

add tests for use domain formal before defined #26664

Merged
merged 1 commit into from
Feb 11, 2025
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
7 changes: 7 additions & 0 deletions test/domains/compilerErrors/domainFormalUseBeforeDefine.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
proc domainArgsInRange(matrix:[0..#D1][0..#D2] real, D1 : int, D2 : int) {
// should be an error to use D1 and D2 before defined
}

proc domainArg(ref A:[dom1] real, ref B:[dom1] real, dom1:domain(1)) {
// should be an error to use dom1 before defined
}
10 changes: 10 additions & 0 deletions test/domains/compilerErrors/domainFormalUseBeforeDefine.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
domainFormalUseBeforeDefine.chpl:1: In function 'domainArgsInRange':
domainFormalUseBeforeDefine.chpl:1: error: statement references variable 'D1' before it is defined
domainFormalUseBeforeDefine.chpl:1: note: the variable 'D1' is defined here
domainFormalUseBeforeDefine.chpl:1: error: statement references variable 'D2' before it is defined
domainFormalUseBeforeDefine.chpl:1: note: the variable 'D2' is defined here
domainFormalUseBeforeDefine.chpl:5: In function 'domainArg':
domainFormalUseBeforeDefine.chpl:5: error: statement references variable 'dom1' before it is defined
domainFormalUseBeforeDefine.chpl:5: note: the variable 'dom1' is defined here
domainFormalUseBeforeDefine.chpl:5: error: statement references variable 'dom1' before it is defined
domainFormalUseBeforeDefine.chpl:5: note: the variable 'dom1' is defined here