mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +03:00
commit
73c8b59bb5
13 changed files with 72 additions and 75 deletions
|
@ -1263,12 +1263,12 @@ unittest
|
|||
static struct S3
|
||||
{
|
||||
int i;
|
||||
this(this){};
|
||||
this(this){}
|
||||
}
|
||||
static struct S4
|
||||
{
|
||||
int i = 1;
|
||||
this(this){};
|
||||
this(this){}
|
||||
}
|
||||
static assert (!hasElaborateAssign!S1);
|
||||
static assert (!hasElaborateAssign!S2);
|
||||
|
|
|
@ -723,9 +723,8 @@ struct BitArray
|
|||
lo++;
|
||||
hi--;
|
||||
}
|
||||
Ldone:
|
||||
;
|
||||
}
|
||||
Ldone:
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -2181,10 +2181,10 @@ Target parse(Target, Source)(ref Source p)
|
|||
{
|
||||
static import core.stdc.math/* : HUGE_VAL*/;
|
||||
|
||||
static immutable real negtab[14] =
|
||||
static immutable real[14] negtab =
|
||||
[ 1e-4096L,1e-2048L,1e-1024L,1e-512L,1e-256L,1e-128L,1e-64L,1e-32L,
|
||||
1e-16L,1e-8L,1e-4L,1e-2L,1e-1L,1.0L ];
|
||||
static immutable real postab[13] =
|
||||
static immutable real[13] postab =
|
||||
[ 1e+4096L,1e+2048L,1e+1024L,1e+512L,1e+256L,1e+128L,1e+64L,1e+32L,
|
||||
1e+16L,1e+8L,1e+4L,1e+2L,1e+1L ];
|
||||
// static immutable string infinity = "infinity";
|
||||
|
@ -2574,7 +2574,7 @@ unittest
|
|||
debug(conv) scope(success) writeln("unittest @", __FILE__, ":", __LINE__, " succeeded.");
|
||||
struct longdouble
|
||||
{
|
||||
ushort value[5];
|
||||
ushort[5] value;
|
||||
}
|
||||
|
||||
real ld;
|
||||
|
|
|
@ -430,7 +430,7 @@ unittest
|
|||
int value;
|
||||
}
|
||||
|
||||
Layout ans[3];
|
||||
Layout[3] ans;
|
||||
ans[0].name = "one";
|
||||
ans[0].value = 1;
|
||||
ans[1].name = "two";
|
||||
|
@ -481,7 +481,7 @@ unittest
|
|||
double other;
|
||||
}
|
||||
|
||||
Layout ans[2];
|
||||
Layout[2] ans;
|
||||
ans[0].name = "\U00010143Hello";
|
||||
ans[0].value = 65;
|
||||
ans[0].other = 63.63;
|
||||
|
@ -528,7 +528,7 @@ unittest
|
|||
|
||||
auto records = csvReader!Layout(str, ["b","c","a"]);
|
||||
|
||||
Layout ans[2];
|
||||
Layout[2] ans;
|
||||
ans[0].name = "Hello";
|
||||
ans[0].value = 65;
|
||||
ans[0].other = 63.63;
|
||||
|
|
|
@ -1402,7 +1402,7 @@ private void formatUnsigned(Writer, Char)(Writer w, ulong arg, ref FormatSpec!Ch
|
|||
forcedPrefix = '-';
|
||||
}
|
||||
// fill the digits
|
||||
char buffer[64]; // 64 bits in base 2 at most
|
||||
char[64] buffer; // 64 bits in base 2 at most
|
||||
char[] digits;
|
||||
{
|
||||
uint i = buffer.length;
|
||||
|
@ -1592,8 +1592,8 @@ if (is(FloatingPointTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
|
|||
}
|
||||
}
|
||||
if (fs.spec == 's') fs.spec = 'g';
|
||||
char sprintfSpec[1 /*%*/ + 5 /*flags*/ + 3 /*width.prec*/ + 2 /*format*/
|
||||
+ 1 /*\0*/] = void;
|
||||
char[1 /*%*/ + 5 /*flags*/ + 3 /*width.prec*/ + 2 /*format*/
|
||||
+ 1 /*\0*/] sprintfSpec = void;
|
||||
sprintfSpec[0] = '%';
|
||||
uint i = 1;
|
||||
if (fs.flDash) sprintfSpec[i++] = '-';
|
||||
|
|
22
std/math.d
22
std/math.d
|
@ -123,8 +123,8 @@ version(unittest)
|
|||
if (isnan(x) || isnan(y))
|
||||
return 0;
|
||||
|
||||
char bufx[30];
|
||||
char bufy[30];
|
||||
char[30] bufx;
|
||||
char[30] bufy;
|
||||
assert(ndigits < bufx.length);
|
||||
|
||||
int ix;
|
||||
|
@ -486,8 +486,7 @@ trigerr:
|
|||
}
|
||||
return real.nan;
|
||||
|
||||
Lret:
|
||||
;
|
||||
Lret: {}
|
||||
}
|
||||
else version(D_InlineAsm_X86_64)
|
||||
{
|
||||
|
@ -535,8 +534,7 @@ trigerr:
|
|||
}
|
||||
return real.nan;
|
||||
|
||||
Lret:
|
||||
;
|
||||
Lret: {}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -546,7 +544,7 @@ Lret:
|
|||
|
||||
unittest
|
||||
{
|
||||
static real vals[][2] = // angle,tan
|
||||
static real[2][] vals = // angle,tan
|
||||
[
|
||||
[ 0, 0],
|
||||
[ .5, .5463024898],
|
||||
|
@ -1788,7 +1786,7 @@ real frexp(real value, out int exp) @trusted pure nothrow
|
|||
|
||||
unittest
|
||||
{
|
||||
static real vals[][3] = // x,frexp,exp
|
||||
static real[3][] vals = // x,frexp,exp
|
||||
[
|
||||
[0.0, 0.0, 0],
|
||||
[-0.0, -0.0, 0],
|
||||
|
@ -1818,7 +1816,7 @@ unittest
|
|||
|
||||
static if (real.mant_dig == 64)
|
||||
{
|
||||
static real extendedvals[][3] = [ // x,frexp,exp
|
||||
static real[3][] extendedvals = [ // x,frexp,exp
|
||||
[0x1.a5f1c2eb3fe4efp+73L, 0x1.A5F1C2EB3FE4EFp-1L, 74], // normal
|
||||
[0x1.fa01712e8f0471ap-1064L, 0x1.fa01712e8f0471ap-1L, -1063],
|
||||
[real.min_normal, .5, -16381],
|
||||
|
@ -1929,7 +1927,7 @@ unittest
|
|||
|
||||
unittest
|
||||
{
|
||||
static real vals[][3] = // value,exp,ldexp
|
||||
static real[3][] vals = // value,exp,ldexp
|
||||
[
|
||||
[ 0, 0, 0],
|
||||
[ 1, 0, 1],
|
||||
|
@ -2305,7 +2303,7 @@ real hypot(real x, real y) @safe pure nothrow
|
|||
|
||||
unittest
|
||||
{
|
||||
static real vals[][3] = // x,y,hypot
|
||||
static real[3][] vals = // x,y,hypot
|
||||
[
|
||||
[ 0.0, 0.0, 0.0],
|
||||
[ 0.0, -0.0, 0.0],
|
||||
|
@ -4725,7 +4723,7 @@ unittest
|
|||
{
|
||||
debug (math) printf("math.poly.unittest\n");
|
||||
real x = 3.1;
|
||||
static real pp[] = [56.1, 32.7, 6];
|
||||
static real[] pp = [56.1, 32.7, 6];
|
||||
|
||||
assert( poly(x, pp) == (56.1L + (32.7L + 6L * x) * x) );
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ struct MD5_CTX
|
|||
*/
|
||||
void finish(ref ubyte[16] digest) /* message digest */
|
||||
{
|
||||
ubyte bits[8] = void;
|
||||
ubyte[8] bits = void;
|
||||
uint index, padLen;
|
||||
|
||||
/* Save number of bits */
|
||||
|
|
|
@ -2068,7 +2068,7 @@ unittest
|
|||
["nyuk", "I", "have", "no", "chocolate", "giba"],
|
||||
["wyda", "I", "have", "I", "have", "have", "I", "have", "hehe"],
|
||||
0.5);
|
||||
double witness[] = [ 7.0, 4.03125, 0, 0 ];
|
||||
double[] witness = [ 7.0, 4.03125, 0, 0 ];
|
||||
foreach (e; sim)
|
||||
{
|
||||
//writeln(e);
|
||||
|
|
|
@ -638,7 +638,7 @@ Parameter for the generator.
|
|||
upperMask = ~((cast(UIntType) 1u <<
|
||||
(UIntType.sizeof * 8 - (w - r))) - 1),
|
||||
lowerMask = (cast(UIntType) 1u << r) - 1;
|
||||
static immutable UIntType mag01[2] = [0x0UL, a];
|
||||
static immutable UIntType[2] mag01 = [0x0UL, a];
|
||||
|
||||
ulong y = void;
|
||||
|
||||
|
|
14
std/regex.d
14
std/regex.d
|
@ -648,10 +648,10 @@ enum RegexOption: uint {
|
|||
nonunicode = 0x8,
|
||||
multiline = 0x10,
|
||||
singleline = 0x20
|
||||
};
|
||||
}
|
||||
alias TypeTuple!('g', 'i', 'x', 'U', 'm', 's') RegexOptionNames;//do not reorder this list
|
||||
static assert( RegexOption.max < 0x80);
|
||||
enum RegexInfo : uint { oneShot = 0x80 };
|
||||
enum RegexInfo : uint { oneShot = 0x80 }
|
||||
|
||||
private enum NEL = '\u0085', LS = '\u2028', PS = '\u2029';
|
||||
|
||||
|
@ -683,7 +683,7 @@ dchar parseUniHex(Char)(ref Char[] str, size_t maxDigit)
|
|||
{
|
||||
string[] non_hex = [ "000j", "000z", "FffG", "0Z"];
|
||||
string[] hex = [ "01", "ff", "00af", "10FFFF" ];
|
||||
int value[] = [ 1, 0xFF, 0xAF, 0x10FFFF ];
|
||||
int[] value = [ 1, 0xFF, 0xAF, 0x10FFFF ];
|
||||
foreach(v; non_hex)
|
||||
assert(collectException(parseUniHex(v, v.length)).msg
|
||||
.canFind("invalid escape sequence"));
|
||||
|
@ -1400,7 +1400,7 @@ struct Parser(R, bool CTFE = false)
|
|||
//CodepointSet operations relatively in order of priority
|
||||
enum Operator:uint {
|
||||
Open = 0, Negate, Difference, SymDifference, Intersection, Union, None
|
||||
};
|
||||
}
|
||||
|
||||
//parse unit of CodepointSet spec, most notably escape sequences and char ranges
|
||||
//also fetches next set operation
|
||||
|
@ -2022,7 +2022,7 @@ public struct Regex(Char)
|
|||
end = e;
|
||||
}
|
||||
|
||||
@property string front() { return groups[start].name; };
|
||||
@property string front() { return groups[start].name; }
|
||||
@property string back() { return groups[end-1].name; }
|
||||
@property bool empty() { return start >= end; }
|
||||
@property size_t length() { return end - start; }
|
||||
|
@ -2030,7 +2030,7 @@ public struct Regex(Char)
|
|||
@property NamedGroupRange save()
|
||||
{
|
||||
return NamedGroupRange(groups, start, end);
|
||||
};
|
||||
}
|
||||
void popFront() { assert(!empty); start++; }
|
||||
void popBack() { assert(!empty); end--; }
|
||||
string opIndex()(size_t i)
|
||||
|
@ -2639,7 +2639,7 @@ public:
|
|||
fChar = re.ir[i].data;
|
||||
static if(charSize != 3)
|
||||
{
|
||||
Char buf[dchar.sizeof/Char.sizeof];
|
||||
Char[dchar.sizeof/Char.sizeof] buf;
|
||||
encode(buf, fChar);
|
||||
fChar = buf[0];
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ unittest
|
|||
//{
|
||||
auto p = toStringz("foo");
|
||||
assert(strlen(p) == 3);
|
||||
const(char) foo[] = "abbzxyzzy";
|
||||
const(char)[] foo = "abbzxyzzy";
|
||||
p = toStringz(foo[3..5]);
|
||||
assert(strlen(p) == 2);
|
||||
|
||||
|
|
|
@ -2481,4 +2481,4 @@ Lis:
|
|||
}
|
||||
else
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue