Skip to content

Commit 55dc8a1

Browse files
committed
Fix oneof union mixin.
1 parent c3aab89 commit 55dc8a1

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

src/google/protobuf/common.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,14 @@ enum string oneofAccessorName(alias field) = {
130130

131131
enum string oneofAccessors(alias field) = {
132132
import std.string : format;
133+
import std.traits : fullyQualifiedName;
133134

134135
enum accessorName = oneofAccessorName!field;
135136

136137
return "
137138
@property %1$s %2$s() { return %3$s == typeof(%3$s).%2$s ? _%2$s : protoDefaultValue!(%1$s); }
138139
@property void %2$s(%1$s _) { _%2$s = _; %3$s = typeof(%3$s).%2$s; }
139-
".format(typeof(field).stringof, accessorName, oneofCaseFieldName!field);
140+
".format(fullyQualifiedName!(typeof(field)), accessorName, oneofCaseFieldName!field);
140141
}();
141142

142143
template Message(T)

test/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test-test-library

test/a/b/c.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ message C {
1515
A.B ob = 2;
1616
int32 oi = 3;
1717
}
18-
}
18+
}

test/dub.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "test",
3+
"targetType": "library",
4+
"targetName": "test",
5+
"importPaths": ["golden"],
6+
"sourcePaths": ["golden"],
7+
"dependencies": {
8+
"protobuf": { "path": ".." }
9+
}
10+
}

test/run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ cd -
99
rm -rf generated
1010
mkdir generated
1111

12+
dub test
13+
if [ $? -ne 0 ]; then
14+
echo "ERROR: golden is invalid."
15+
exit 1
16+
fi
17+
1218
check() {
1319
protoc ${PROTO_PATH:-} --plugin=../build/protoc-gen-d "${1}" --d_out=generated
1420
# Ignore `enum protocVersion = ...;" line because it depends on the env.

0 commit comments

Comments
 (0)