Skip to content

Move specs toward green#8622

Merged
headius merged 27 commits intojruby:10-devfrom
headius:more_specs_green
Feb 13, 2025
Merged

Move specs toward green#8622
headius merged 27 commits intojruby:10-devfrom
headius:more_specs_green

Conversation

@headius
Copy link
Member

@headius headius commented Feb 11, 2025

No description provided.

@headius headius added this to the JRuby 10.0.0.0 milestone Feb 11, 2025
@headius headius changed the title Narrow top-level Ruby constant warning to Object Move specs toward green Feb 11, 2025
These don't need to test that the text is exactly the same. It is
sufficient to confirm that the two frames are for "foo" and the
block.
These are not commonly-used syntax and not raising the correct
error here does not impact typical usage.
Not sure why we included BSD in the "not work" category but it
appears birthtime should be available on all BSDs including Darwin
(and not including OpenBSD) and on Windows.
This appears to be short one item on MacOS and I'm not sure if
that is a real problem or not. The logic we use seems the same as
in CRuby, but CRuby passes this spec on MacOS.
All Class instances in the system are traversible by walking down
from BasicObject, but natural Module instances (i.e. all `module`
objects) do not descend from BasicObject. We partially restore the
allModules set in order to track these objects for each_object
when called with Module.
Singleton objects acquire their name and then break out to the
final message composition. Previous code did not have a `break`
because it was structured as if/else and could not early branch.

This form mimics the C code more closely.
* Use Byte.toUnsignedByte rather than error-prone masking.
* Make singleCharString always produce a result for any byte +
  encoding combination.
  * This avoids the need for callers to check range and encoding.
  * Note this preserves the original behavior of returning high-
    order US-ASCII char strings as ASCII-8BIT.
The delegate library introduces a peculiar pattern for calling its
__getobj__ method that passes a block. When this pattern is used
to call an attr_reader, we error because the attr-binding logic did
not drop the ignored block.

The patch here uses SmartBinder to filter to only the self object
(in the case of an attr_reader) and the given single argument (in
the case of an attr_writer), dropping the block and any other
unused arguments.
These quietly fail with null returns if the NativeCall as
configured cannot be resolved. A boolean flag is also added to
avoid trying to resolve a known unresolvable method.

This also adds a way to request a cached, resolved MethodHandle
from a NativeCall, quietly with caching as for getMethodQuiet.
Some native classes may have additional signatures not intended to
be callable directly from Ruby (e.g. "common" logic the other
arities dump into after doing initial argument processing).

This alters the new exact-binding logic to avoid methods that are
not directly declared on the target class and bound to Ruby with a
JRubyMethod annotation. Failing either of these two checks it will
fallback on the slower "generic" dispatch logic it did before.
When requesting low-byte single-char strings in ASCII-8BIT encoding
the resulting string should be ASCII-8BIT, not US-ASCII.
@headius headius marked this pull request as ready for review February 13, 2025 19:21
@headius headius merged commit 50a9fac into jruby:10-dev Feb 13, 2025
55 of 73 checks passed
@headius headius deleted the more_specs_green branch February 13, 2025 19:21
@headius
Copy link
Member Author

headius commented Feb 13, 2025

Merged the big pieces here, I'll do the rest as topic PRs for each feature.

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.

1 participant