Skip to content

Add type restrictions to http#15710

Merged
straight-shoota merged 6 commits intocrystal-lang:masterfrom
Vici37:add-type-restrictions-to-http
Sep 6, 2025
Merged

Add type restrictions to http#15710
straight-shoota merged 6 commits intocrystal-lang:masterfrom
Vici37:add-type-restrictions-to-http

Conversation

@Vici37
Copy link
Contributor

@Vici37 Vici37 commented Apr 27, 2025

This is the output of compiling cr-source-typer and running it with the below incantation:

CRYSTAL_PATH="./src" ./typer spec/std_spec.cr
--error-trace --exclude src/crystal/
--stats --progress
--union-size-threshold 2
--ignore-private-defs
--ignore-protected-defs
src/http

This is related to #15682 .

I also reran the above command but without the --union-size-threshold 2, and updated several long union types to a common base class (typically IO).

@straight-shoota straight-shoota added this to the 1.18.0 milestone Sep 4, 2025
@straight-shoota straight-shoota merged commit a332ab8 into crystal-lang:master Sep 6, 2025
39 checks passed

# Sets request's query component.
def query=(value)
def query=(value : String) : String
Copy link
Member

Choose a reason for hiding this comment

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

This one caused a regression in Athena since before you could pass nil as per https://crystal-lang.org/api/URI.html#query%3D%28query%3AString%7CNil%29-instance-method

straight-shoota added a commit that referenced this pull request Feb 1, 2026
Fixes a regression from 1.18 (#15710).
That change added type restrictions to `Headers[]=` which should've caused a type error in `Headers#merge!`, but this was shadowed by unexpected behaviour from `forward_missing_to`.
The error condition was not triggered in specs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants