Skip to content

Format begin end comment#1

Open
anathaedra wants to merge 266 commits intoanathaedra:masterfrom
makenowjust:format-begin-end-comment
Open

Format begin end comment#1
anathaedra wants to merge 266 commits intoanathaedra:masterfrom
makenowjust:format-begin-end-comment

Conversation

@anathaedra
Copy link
Copy Markdown
Owner

Shard key start

.Shard key. Loop

Shard key Completion
Shard unkey @anathaedra

oprypin and others added 30 commits May 11, 2020 12:26
* Validate raise has the right return type before using it in the no closure check

Otherwise this returns a hard to understand LLVM IR verification error

* Skip no closure check for non-Crystal procs

They can't have a closure anyways and more importantly are represented as a single
pointer. So the check could not even deconstruct them into two pointers.
This previously generated invalid code trying to pass the function pointer
type to the check function expecting the Crystal proc type
* Split Context from Metadata

Keep Log::Context for DSL over the current fiber context.
Make it a wrapper over Log::Metadata

* Revert guarantee of restoring fiber context automatically

With entry local metadata this is no longer need.

* Rename methods

* Add emitter dsl

* Enforce hash like metadata in entry.

And display it in IO::Backend#default_format

* Fix docs

* Fix immutability of datum in nested containers
* Refactor Log::Formatter

* Add docs to log/format.cr

* Some renames in log/format.cr

* Add Log::StaticFormatter#pid

* Apply log formatter renames on spec
* Refactor spec hooks

* Refactor all spec hooks to work in the root context
* Deprecate hook methods in Spec namespace
* Improve documentation of spec hooks
* Add spec for spec hooks

* Reset DSL methods to raise on top level

* crystal tool format
* Extract call stack code to different files acording to platform

* On ELF platforms, use `dl_iterate_phdr` to load DWARF data already offsetted

* Use SizeT for the `base_address` in DWARF::LineNumbers

* Move definition of `dl_iterate_phdr` and ELF types to `lib_c`

* Remove HACK from comment
* Mark Digest::* methods private.

* Add abstract methods to Digest::Base.
Allow resetting digests.
Move some OpenSSL::Digest methods to Digest::Base.

* OpenSSL::Digest inherit from Digest::Base and use it's interface.

* Suggestions from @straight-shoota

* Remove @message_block reset.

* [WIP] Deprecate #digest and #hexdigest.  Detect #final misuse.

TODO:
  Use #final in specs after API approval.

* Update src/digest/base.cr

Co-Authored-By: Sijawusz Pur Rahnama <sija@sija.pl>

* Deprecate #digest and #hexdigest.  Detect #final misuse.

* Suggestions from @RX14.

* Update src/digest/base.cr

Co-Authored-By: Sijawusz Pur Rahnama <sija@sija.pl>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Use private abstract methods instead of overrides.

* Suggestions from @straight-shoota

* Suggstions from @Sija

* Abstract reset and documentation.

* Update src/digest/md5.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Update src/digest/sha1.cr

Co-Authored-By: Sijawusz Pur Rahnama <sija@sija.pl>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Update src/digest/base.cr

Co-Authored-By: Johannes Müller <johannes.mueller@smj-fulda.org>

* Suggestion from @straight-shoota

* Update src/digest/base.cr

Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>

Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
Co-authored-by: Johannes Müller <johannes.mueller@smj-fulda.org>
…rystal-lang#9134)

* Reorganize Enumerable#join specs

* Add IO-first overloads to Enumerable#join

* Fix deprecated uses of Enumerable#join

* Fix deprecated uses of Int#to_s

* Add IO-first overload to Int#to_s

* Change upcase argument of Int#to_s to a named argument

* Add IO-first overloads to String methods

* Change to IO-first methods in Crystal::Exception

* Add IO-first overload to Time#to_s
* Replace Docs::Generator#repository_name with ProjectInfo#name

* Add ProjectInfo#refname

* Add ProjectInfo#source_url_pattern

* Refactor docs generator to use ProjectInfo#source_url

* Add CLI options for refname and url pattern
* XML: improve xpath regarding namespaces

* Add a few type restrictions and remove an unnecessary `to_s`
* Compiler: cast fun function pointer to Proc

* Compiler: when assigning nil to a pointer/proc struct field, don't check
closure

* Remove unneeded raise in spec

* Update spec/compiler/codegen/closure_spec.cr

Co-authored-by: Jonne Haß <me@jhass.eu>

Co-authored-by: Jonne Haß <me@jhass.eu>
This make will stop accepting :warning 
 and LOG_LEVEL=WARNING in favor of :warn and LOG_LEVEL=WARN.
…ang#9294)

* Avoid requiring non std-lib spec spec_helper in hooks_spec

* Refactor: DRY

* Completely remove top level spec_helper from std specs
* Add IO overloads to various String case methods

* Replace with_io_memory with String.build

* Restore ascii optimization for non IO overloads
* Escape CDATA end sequences

* Update src/xml/builder.cr

Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>

* Add backticks to other CDATA reference

Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
* Add `StringLiteral#titleize` macro method

This also adds `SymbolLiteral#titleize` and `MacroId#titleize`.

Other case conversion methods (`upcase`, `camelcase`, etc)  are avialble
in macro. So, `#titleize` should not be exception.

One use-case is generating error message from type name.

* Add specs for `SymbolLiteral#titleize` and `MacroId#titleize`
* Add methods to `TypeNode` to check if its a module, class, or struct

Adds specs and updates docs for `#nilable?`, `#abstract?` and `#union?`

* Fix typo in struct? documentation

Co-authored-by: Jonne Haß <me@jhass.eu>

Co-authored-by: Jonne Haß <me@jhass.eu>
* Resolve the always-present Windows linker's warnings

Currently when building on Windows, the version of MSVC linker is always printed first, then the list of all inputs, then a warning for every object file because it ends with .o, not .obj.

So, use the .obj extension and disable the default outputs. So errors are still printed, but normally the output is empty.

* Also switch the file extension for llvm_ext.obj
* Parser: rewrite type parser

For some reasons, the parser for types and generic type path literals is
known as one of the most complex part of the parser.
(Another one is `do ... end` block parsing.)

- **too much sharing**: the parser for a single type, type arguments,
  proc type arguments, tuple element types and others are unified to just one method.
  This code-sharing is excessive. They are not share syntax really, so there are many
  conditions and branches, thus it is hard to follow code flow.
- **historical naming**: a type path (or part ot this) is called as `ident` for historical reason.
  However `ident` means different today.

As the above reasons, gazillion bugs live in there unfortunately.
For instance, they are valid type restriction for now:

  - `*Foo` (orphan splat)
  - `(Foo, Bar) | Baz` (comma + union type)
  - `{(Foo, Bar), Baz}` (comma + tuple type)

This commit refines type grammer and rewrite parsers.

* Update src/compiler/crystal/syntax/parser.cr

Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>

* Use Generic and Union for nilable type properly

crystal-lang#9208 (comment)

and, some bugs are fixed.

* Remove unnecessary if

Co-authored-by: Brian J. Cardiff <bcardiff@gmail.com>
…rystal-lang#9233)

* IO#skip returns the number of bytes it skipped

* make IO#skip return UInt64

* Allow Int arguments in IO#skip

* Add specs assertions for skip / skip_to_end

* Refactor: delegate IO::Stapled#skip_to_end directly to reader

* Make IO#write return bytes written

* Add specs, make printf return written bytes

* Avoid using the BytesCounter wrapper

Return bytes only in write_* operations.
printf, puts, etc return Nil

* Use &+

* Remove CHECK comments

Co-authored-by: Carl Hörberg <carl.hoerberg@gmail.com>
…9305)

GitHub and Gitlab won't resolve source URLs when the repo name has a
.git extension. This extension works for other use cases (like git
URLs).
…ng#9310)

* Implement Process(env:) on Windows and add more Env specs

Co-authored-by: Jan Zajic <jan.zajic@corpus.cz>

* Add comment about "empty" keys in env

* Add comments

Co-authored-by: Jan Zajic <jan.zajic@corpus.cz>
…rystal-lang#9283)

* Support different number of fraction digits for RFC3339 time format.

Added `fraction_digits` parameter to `Time#to_rfc3339` and `Time#to_rfc3339(IO)`.

* `Time::Format::Formatter#second_fraction?` also raises with negative values

* Make the `fraction_digits` a keyword argument in `Time#to_rfc3339`

* RFC3339 format without seconds by default

* Change the default of `second_fraction?` back to full precision
asterite and others added 14 commits September 30, 2020 10:30
…rystal-lang#9767)

As far as I can tell, passing this flag just has no downsides. Without it, symlinks can be created only as administrator; with it, symlinks still can't be created by default, but can be if only "developer mode" is enabled in Windows. But I'm guessing that'll be a requirement for most things anyway.
* Fix `Process.find_executable` once and for all

Make it work on Windows.
Make it actually check that the found path is an *executable* *file*.
Fix a lot of edge cases.
Add specs and also verify that these expectations exactly match what Process.new would do.

* fixup! Fix `Process.find_executable` once and for all

* Expand the comment in the manual spec

* Factor out a function listing possibilities of a path to check

* Address review comments + refactor

* Simplify compilation of test executables, doesn't have to be parallel

* Add spec involving `..`

* Resolve review comments
* Fix Iterator#cons_pair return type

* Removed redundant return check

wrapped_next already checks for stop
…ng#9792)

* Use dwarf if available on Exception::CallStack.print_frame

Calling callee at the beginning of the program will load dwarf

* Load dwarf on start up and look for it only if compiled with --debug
Otherwise it is impossible on medium projects with crystal-db to run with the gc_none flag.
* Make abstract def return type warning an error

Fixes crystal-lang#9655

* Drop AbstractDefImplementationError

* Drop skip_abstract_def_check flag
Prevent Secure Client-Initiated Renegotiation vulnerability attack by default on servers

Ref: https://www.openssl.org/docs/man1.1.0/man3/SSL_CTX_set_options.html#SECURE-RENEGOTIATION
Follow up crystal-lang#9722

The following example still invokes a formatter issue like crystal-lang#9657.

```
begin
  1
  # Comment

end
```

This commit fixes such issues.
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
@makenowjust makenowjust force-pushed the format-begin-end-comment branch from 6528950 to 1468987 Compare October 16, 2020 18:01
Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WUT

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WUT

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WUT

@AnathaedraxD
Copy link
Copy Markdown

Merge

@Armode Armode mentioned this pull request Mar 1, 2024
Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link
Copy Markdown

@Armode Armode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

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.