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.
unstabilize == between unbounded and bounded ranges over enums and bo…
…ols and return true (chapel-lang#23036) In Issue chapel-lang#20896 we have decided that `==` for unbounded ranges with finite Idxtypes (i.e. enums and bools) should behave as if those ranges were bounded since the represented sequence is the same in both cases. This means for example ```chapel writeln(false..==false..true); // unstable; print 'true' writeln(false.. by -1 ==..true by -1); // unstable; print 'true' ``` [Reviewed by @vasslitvinov ]
- Loading branch information
Showing
5 changed files
with
136 additions
and
12 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,12 +1,22 @@ | ||
false | ||
false | ||
false | ||
false | ||
false | ||
false | ||
false | ||
false | ||
false | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
false | ||
false | ||
false | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
false | ||
false | ||
false |
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,44 @@ | ||
enum color {red, green, blue}; | ||
use color; | ||
|
||
var rgb = red..blue; | ||
var rdd = red..; | ||
var ddb = ..blue; | ||
var negrgb = red..blue by -1; | ||
var negrdd = red.. by -1; | ||
var negddb = ..blue by -1; | ||
var dd: range(color, boundKind.neither); | ||
|
||
writeln(rgb == rdd); | ||
writeln(rgb == ddb); | ||
writeln(rgb == dd); | ||
|
||
writeln(rdd == ddb); | ||
writeln(rdd == dd); | ||
|
||
writeln(ddb == dd); | ||
writeln(negrgb == negrdd); | ||
writeln(negrdd == negddb); | ||
writeln(negrdd == dd); | ||
|
||
{ | ||
var ft = false..true; | ||
var fdd = false..; | ||
var ddt = ..true; | ||
var negft = false..true by -1; | ||
var negfdd = false.. by -1; | ||
var negddt = ..true by -1; | ||
var dd: range(bool, boundKind.neither); | ||
|
||
writeln(ft == fdd); | ||
writeln(ft == ddt); | ||
writeln(ft == dd); | ||
|
||
writeln(fdd == ddt); | ||
writeln(fdd == dd); | ||
|
||
writeln(ddt == dd); | ||
writeln(negft == negfdd); | ||
writeln(negfdd == negddt); | ||
writeln(negfdd == dd); | ||
} |
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,36 @@ | ||
compareRangeUnboundedEnumBool.chpl:12: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:13: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:14: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:16: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:17: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:19: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:20: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:21: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:22: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:33: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:34: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:35: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:37: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:38: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:40: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:41: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:42: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
compareRangeUnboundedEnumBool.chpl:43: warning: == between unbounded and bounded ranges is unstable and its behavior may change in the future | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
false | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
true | ||
false |