-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmxin.d
84 lines (67 loc) · 1.45 KB
/
mxin.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
struct FOFOFO{
enum x = undef; // error
mixin(`float a11=`~foo1~";"); // error
}
enum x = "enum xx = q{int y = 0;};";
struct SS{
mixin(xx);
mixin(x); // TODO
}
struct S{
enum z = y;
enum x = "enum xx = q{immutable y = 123;};";
mixin(xx);
mixin(x);
static assert(z == 123);
}
struct MixinEvalOrder{
enum x = "string xx = q{int y = 0;};";
struct S{
mixin(x); // TODO: we want this to work (?)
mixin(xx);
}
}
struct MixinAccessCheck{
struct S{
immutable int x = 2;
}
pragma(msg, mixin(q{S.x}));
template ReturnType(func...) if (func.length == 1) {
alias int ReturnType;
}
struct BinaryOperatorX(string _op, rhs_t,C) {
ReturnType!(mixin("C.opBinary!(_op,rhs_t)")) RET_T;
}
class MyClass {
auto opBinary(string op, T)() { }
}
void PydMain() {
BinaryOperatorX!("+", int, MyClass) foo;
}
}
mixin(q{pragma(msg, is(typeof({immutable(char)[] x=['2'];}())));});
enum immutable(dchar)[] fooz = "hello";
//pragma(msg, "fooz");
pragma(msg, typeof(fooz));
//mixin(`hallo velo();`);
void foo(){
//mixin(x"abcd"); // TODO: fix utf exception
mixin("abcd"); // error
pragma(msg, is(typeof(bar)));
}
mixin(q{ // error
void main(){
mixin("pragma(msg,mixin(q{`hooray!`}));pragma(msg,mixin(q{moo}));");
mixin("2;");
mixin("22"~"=22;");
mixin(22);
mixin(cast(dchar[])['2','a']~";");
dchar[] x;
immutable(dchar)[] y=x;
(){immutable(char)[] x = ['2'];}();
int oops;
mixin(`int oops;`);
}
});
// +/
alias immutable(char)[] string;