Skip to content

Commit 88dc1af

Browse files
committed
Revert "WIP: Hacky fix for wrong method set order with unicode."
This reverts commit c4db7b2. That commit was a temporary hacky fix to help find out where the issue was. It's not a general fix. Revert it, and file issue gopherjs#763 to resolve this issue fully and correctly.
1 parent 28e102c commit 88dc1af

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

compiler/natives/src/reflect/reflect_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ var deepEqualTests = []DeepEqualTest{
157157
//{&loopy1, &loopy2, true}, // TODO: Fix.
158158
}
159159

160+
// TODO: Fix this. See https://github.com/gopherjs/gopherjs/issues/763.
161+
func TestIssue22073(t *testing.T) {
162+
m := reflect.ValueOf(NonExportedFirst(0)).Method(0)
163+
164+
if got := m.Type().NumOut(); got != 0 {
165+
t.Errorf("NumOut: got %v, want 0", got)
166+
}
167+
168+
// TODO: Fix this. The call below fails with:
169+
//
170+
// var $call = function(fn, rcvr, args) { return fn.apply(rcvr, args); };
171+
// ^
172+
// TypeError: Cannot read property 'apply' of undefined
173+
174+
// Shouldn't panic.
175+
//m.Call(nil)
176+
}
177+
160178
func TestCallReturnsEmpty(t *testing.T) {
161179
t.Skip("test uses runtime.SetFinalizer, which is not supported by GopherJS")
162180
}

compiler/prelude/types.go

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

0 commit comments

Comments
 (0)