forked from chapel-lang/chapel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a uAST conversion bug that incorrectly converted some array types (…
…chapel-lang#24560) Resolves chapel-lang#18717. Fixes a bug which caused an array type preceded by the `borrowed` keyword to be incorrectly transformed into a loop. This led to internal errors when the loop was queried for its type information. At a syntactic level, array types and loops are indistinguishable. However, in type-only contexts (such as for formal types, or for return types) we can always convert a "loop" into an array type. This PR adjusts the uAST converter so that it can handle converting array types at arbitrary depths. This covers array types that follow the `borrowed` keyword (which is represented as a "call"). TESTING - [x] `linux64`, `standard` - [x] `linux64`, `COMM=gasnet` Reviewed by @mppf, @vasslitvinov. Thanks!
- Loading branch information
Showing
5 changed files
with
50 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
borrowed-array.chpl:2: error: cannot make [domain(1,int(64),one)] real(64) into a borrowed class | ||
borrowed-array.chpl:2: error: assigning to a range with boundKind.both from a range with boundKind.neither without an explicit cast | ||
note: An additional error is hidden. Use --print-additional-errors to see it. |
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,19 @@ | ||
record Chunk { | ||
type eltType; | ||
var D: domain(1); | ||
var data: borrowed [D] eltType; | ||
|
||
proc init(type eltType) { | ||
this.eltType = eltType; | ||
} | ||
|
||
proc init(array: [?X] ?t) { | ||
this.eltType = t; | ||
this.D = X; | ||
this.data = array; | ||
} | ||
} | ||
|
||
proc main() { | ||
var x = new Chunk([1, 2, 3]); | ||
} |
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,3 @@ | ||
Issue18717.chpl:10: In initializer: | ||
Issue18717.chpl:4: error: cannot make [domain(1,int(64),one)] int(64) into a borrowed class | ||
Issue18717.chpl:18: called as Chunk.init(array: [domain(1,int(64),one)] int(64)) |