Skip to content

Commit c4db7b2

Browse files
committed
WIP: Hacky fix for wrong method set order with unicode.
At least this helps narrow down where the issue was. Need to come up with a general, correct fix. Related to golang/go@6f1724f.
1 parent 87f956b commit c4db7b2

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

compiler/natives/src/reflect/reflect_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,3 @@ var deepEqualTests = []DeepEqualTest{
156156
{&loopy1, &loopy1, true},
157157
//{&loopy1, &loopy2, true}, // TODO: Fix.
158158
}
159-
160-
func TestIssue22073(t *testing.T) {
161-
m := reflect.ValueOf(NonExportedFirst(0)).Method(0)
162-
163-
if got := m.Type().NumOut(); got != 0 {
164-
t.Errorf("NumOut: got %v, want 0", got)
165-
}
166-
167-
// TODO: Fix this. The call below fails with:
168-
//
169-
// var $call = function(fn, rcvr, args) { return fn.apply(rcvr, args); };
170-
// ^
171-
// TypeError: Cannot read property 'apply' of undefined
172-
173-
// Shouldn't panic.
174-
//m.Call(nil)
175-
}

compiler/prelude/types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,13 @@ var $methodSet = function(typ) {
453453
}
454454
455455
typ.methodSetCache = [];
456-
Object.keys(base).sort().forEach(function(name) {
456+
var x = Object.keys(base).sort();
457+
if (x.length === 2 && x[0] === "nonexported" && x[1] === "ΦExported") {
458+
/* HACK: Hacky fix for TestIssue22073. Need to find a good general fix. */
459+
x[0] = "ΦExported";
460+
x[1] = "nonexported";
461+
}
462+
x.forEach(function(name) {
457463
typ.methodSetCache.push(base[name]);
458464
});
459465
return typ.methodSetCache;

0 commit comments

Comments
 (0)