Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix remaining standard library test failures #1125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 21, 2022

Conversation

nevkontakte
Copy link
Member

This PR includes following changes:

  • runtime: Callers() and Caller() now filter JS call stack to return something closer to what a program may expect under the upstream Go compiler.
  • runtime: Include call column into position key when assigning pc number for a function call. Just the line isn't sufficient in minified mode, where the whole package code is one line. Together with the above, this fixes t.Helper()-related test failures in the testing package.
  • reflect: fix numerous test failures introduced in Go 1.18:
    • Avoid use of unsafe in TestNestedMethods and TestEmbeddedMethods.
    • Skip TestNotInHeapDeref and TestMethodCallValueCodePtr, which concern
      low-level GC and heap details, inapplicable to GopherJS.
    • Skip TestIssue50208 until generics are supported.
    • Add a hack into methodNameSkip() to make method names match what the
      tests expect. Include original function names in the source map #1085 would
      be a better long-term solution.
    • Stub out verifyNotInHeapPtr(), which is also not applicable to
      GopherJS.

After this PR gopherjs_tests CI workflow is green. For complete Go 1.18 support (aside from generics) we only need to fix several new failures in the gorepo_tests workflow.

Updates #1092.

This function is used when an object method needs to be bound to the
receiver to be invoked elsewhere. Using bind() should be more efficient
here than wrapping it in an anonymous function, and it prevents
unexpected call frames from appearing in the stack trace.
This change makes the returned stack traces more similar to what you'd
get in a regular Go runtime. In particular, it skips certain
GopherJS-specific prelude functions like `$callDeferred()`. I expect we
will be adding to the list as we discover other edge cases.

We also rename certain functions to match their upstream counterparts,
since parts of the standard library rely on this. We mark them as
reserved symbols for prelude minification to make sure this doesn't
break when minified.
This prevents pc collision when minified and virtually all calls and
functions are on the same line.

This change resolves `testing.TestTBHelper` test failure in Go 1.18.
 - Avoid use of unsafe in TestNestedMethods and TestEmbeddedMethods.
 - Skip TestNotInHeapDeref and TestMethodCallValueCodePtr, which concern
   low-level GC and heap details, inapplicable to GopherJS.
 - Skip TestIssue50208 until generics are supported.
 - Add a hack into methodNameSkip() to make method names match what the
   tests expect. gopherjs#1085 would
   be a better long-term solution.
 - Stub out verifyNotInHeapPtr(), which is also not applicable to
   GopherJS.
@nevkontakte nevkontakte requested a review from flimzy July 10, 2022 20:23
@nevkontakte nevkontakte merged commit fe457d0 into gopherjs:go1.18 Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants