Draft
Conversation
cbadb6e to
ccfc69f
Compare
sampersand
commented
Dec 21, 2023
| class Encoding | ||
| # The `_EncodeFallbackAref` is used in functions such as `String::encode` to get the fallback | ||
| # value when a charcater can't be converted between encodings. | ||
| interface _EncodeFallbackAref |
Contributor
Author
There was a problem hiding this comment.
This was moved from String to here
sampersand
commented
Dec 21, 2023
| end.ruby2_keywords | ||
| ) | ||
| end.new() | ||
| end.allocate() |
Contributor
Author
There was a problem hiding this comment.
This is needed because .new implicitly calls .initialize; if method_name is :initialize, then this will accidentally call it with no arguments. Doing it this way prevents that (and since the parent object is BasicObject, :initialize is a no-op anyways)
e75df24 to
e328d88
Compare
e328d88 to
32d4f5b
Compare
45d4635 to
3284d3b
Compare
872d831 to
7fba7c8
Compare
7fba7c8 to
cd13207
Compare
ParadoxV5
reviewed
Dec 26, 2023
Contributor
We have Ruby 3.3 now (: |
Co-authored-by: ParadoxV5 <paradox.ver5@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phew! This one took awhile :-P. This PR updates
IO's instance methods.More specifically, this makes the following general changes:
::_ReaderPartial(renamed toIO::_Readpartial) and::_Rewindable(now unused)String::_EncodeFallbackAref(moved within toEncoding, as it's used for encoding purposes).lib/rbs/unit_test/spy.rbwhere.new()is called instead of.allocate(). This prevents testing instance methods named:initialize.test/stdlib/test_helper.rb:ArefFromStringToString, as it's no longer neededTestHelper::RUBY_EXE, used when spawning shells (IOneeds it forIO#pid)test/stdlib/util/small-file.txtas a small file that can be read from fro testingIO_test.rbto accomodate thewith_xxxforms. However,wait_writableandwait_prioroitycurrently don't have any tests associated with them, as I couldn't figure out a good way to test them. (However, their signatures are pretty simple)It also makes the following changes to
io.rbs:%a{ruby:since:3.2.0}annotation has been added to methods introduced in ruby 3.2.0IO's constant definitions inside of itIOinherits fromFile::Constants(APPEND,FNM_CASEFOLD,LOCK_SH, etc.)IO::EWOULDBLOCKWait{Readable,Writable}constantsIO#initialize:modeis nowopen_mode; updated all the options to be the entire list of accepted options (along with the**untypedthat it for some reason accepts)IO#advise: AddedIO::advicetype alias,offsetandlenare nowint?IO#{lineno,autoclose,sync}=: Now returns their argumentsIO#each: Now its own function;each_linealiases it. Also added in the limit-only variant.IO#each_{byte,char,codepoint}: Reordered branches to haveEnumeratorfirstIO#external_encoding: Added in. (weird that it didnt exist, sinceinternal_encodingexisted before...)IO#{fcntl,ioctl}: Now uses implicits,argumentalso acceptsbool | nilas well.IO#{f{data,}sync,rewind}: Always returns0IO#pid: Can now returnnilIO#pos=: Now takesintIO#p{read,write}: Added inIO#{print,puts}: objects are now_ToSnotuntypedIO#printf: format string is nowstringIO#putc: Separated cases out so return values aren't unionedIO#{gets,read}: reordered branches slightlyIO#readline{,s}: Added in limit-only variantIO#readpartial:outbufis now nilableIO#reopen: Changed(IO) -> IOto be(io) -> sef; added in optional keywords to second caseIO#seek:amountis nownil; also added inIO::whencetype alias.IO#set_encoding: Added in optional encoding argumentsIO#sysread: added implicit conversions;outbufis optional and nilable.IO#sysseek: ADded implicitintforamount; usesIO::whence.IO#timeout=: Now returnsselfnotvoid(which is weird, since almost every other setter in ruby returns its argument...)IO#to_io: Now marked%a{pure}IO#to_path: Added inIO#ungetbyte: Argument accepts implicitstringand is nilable.IO#ungetc: Argument can now beInteger.IO#write_nonblock: Can no longer returnnilnowSince Ruby 3.2 moved the
wait_*methods intoiodirectly (no need forrequire 'io/wait'), the methodsIO#wait{,_{readable,writable,priority}}have been moved fromio/wait.rbs, along withIO::wait_modeand marked as `%a{ruby:since:3.2.0}.