Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Implement more property syntax enforcement #968

Closed
wants to merge 5 commits into
from
View
@@ -1133,17 +1133,17 @@ void initializeAll(Range)(Range range)
if (isForwardRange!Range && is(typeof(range.front = range.front)))
{
alias ElementType!Range T;
- static assert(is(typeof(&(range.front()))) || !hasElaborateAssign!T,
+ static assert(is(typeof(&(range.front))) || !hasElaborateAssign!T,
"Cannot initialize a range that does not expose"
" references to its elements");
static if (!isDynamicArray!Range)
{
- static if (is(typeof(&(range.front()))))
+ static if (is(typeof(&(range.front))))
{
// Range exposes references
for (; !range.empty; range.popFront())
{
- memcpy(&(range.front()), &T.init, T.sizeof);
+ memcpy(&(range.front), &T.init, T.sizeof);
}
}
else
View
@@ -759,7 +759,7 @@ unittest
/++
Returns whether the given file (or directory) exists.
+/
-@property bool exists(in char[] name)
+bool exists(in char[] name)
{
version(Windows)
{
View
@@ -1784,8 +1784,7 @@ unittest
assert(s1[1..5].length == 4);
assert(s1[0..0].empty);
assert(s1[3..3].empty);
- // assert(s1[$ .. $].empty);
- assert(s1[s1.opDollar() .. s1.opDollar()].empty);
+ assert(s1[$ .. $].empty);
auto s2 = stride(arr, 2);
assert(equal(s2[0..2], [1,3]));
@@ -1794,8 +1793,7 @@ unittest
assert(s2[1..5].length == 4);
assert(s2[0..0].empty);
assert(s2[3..3].empty);
- // assert(s2[$ .. $].empty);
- assert(s2[s2.opDollar() .. s2.opDollar()].empty);
+ assert(s2[$ .. $].empty);
// Test fix for Bug 5035
auto m = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]; // 3 rows, 4 columns
@@ -6377,7 +6375,7 @@ ElementType!R moveFront(R)(R r)
return r.moveFront();
} else static if (!hasElaborateCopyConstructor!(ElementType!R)) {
return r.front;
- } else static if (is(typeof(&(r.front())) == ElementType!R*)) {
+ } else static if (is(typeof(&(r.front)) == ElementType!R*)) {
return move(r.front);
} else {
static assert(0,
@@ -6409,7 +6407,7 @@ ElementType!R moveBack(R)(R r)
return r.moveBack();
} else static if (!hasElaborateCopyConstructor!(ElementType!R)) {
return r.back;
- } else static if (is(typeof(&(r.back())) == ElementType!R*)) {
+ } else static if (is(typeof(&(r.back)) == ElementType!R*)) {
return move(r.back);
} else {
static assert(0,