Skip to content

Commit

Permalink
add tests for use domain formal before defined
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmad Rezaii <[email protected]>
  • Loading branch information
arezaii committed Feb 6, 2025
1 parent 6eb636d commit efbd8ea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit efbd8ea

Please sign in to comment.