Skip to content

Commit

Permalink
Merge branch 'master' into mf-crystal_libext
Browse files Browse the repository at this point in the history
  • Loading branch information
maxfierke committed Apr 7, 2021
2 parents fc93817 + e7b46c4 commit 6427b47
Show file tree
Hide file tree
Showing 108 changed files with 1,184 additions and 768 deletions.
7 changes: 5 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
- run: |
git clone https://github.com/crystal-lang/distribution-scripts.git ~/distribution-scripts
cd ~/distribution-scripts
git checkout 80c83b203e1ee2fd54e41398160a67c6a06d34e1
git checkout 4caf7cd337087e2ae313b8c7e00be247d34482ad
# persist relevant information for build process
- run: |
cd ~/distribution-scripts
Expand All @@ -155,7 +155,7 @@ jobs:
echo "export CRYSTAL_SHA1=$CIRCLE_SHA1" >> build.env
# Which previous version use
export PREVIOUS_CRYSTAL_BASE_URL="https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1"
export PREVIOUS_CRYSTAL_BASE_URL="https://github.com/crystal-lang/crystal/releases/download/1.0.0/crystal-1.0.0-1"
echo "export PREVIOUS_CRYSTAL_RELEASE_LINUX64_TARGZ=${PREVIOUS_CRYSTAL_BASE_URL}-linux-x86_64.tar.gz" >> build.env
echo "export PREVIOUS_CRYSTAL_RELEASE_LINUX32_TARGZ=${PREVIOUS_CRYSTAL_BASE_URL}-linux-i686.tar.gz" >> build.env
echo "export PREVIOUS_CRYSTAL_RELEASE_DARWIN_TARGZ=${PREVIOUS_CRYSTAL_BASE_URL}-darwin-x86_64.tar.gz" >> build.env
Expand Down Expand Up @@ -510,6 +510,9 @@ jobs:

workflows:
version: 2
test_all_platforms:
jobs:
- test_darwin
tagged_release:
jobs:
- test_linux:
Expand Down
12 changes: 7 additions & 5 deletions ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Submitting questions
---
name: "\U0001F41B Bug Report"
about: I want to report a bug.
labels: kind:bug
---

If you have a question like "how do I do X?", this is not the right place for asking it. Please ask on the [Crystal Forum](https://forum.crystal-lang.org), on our combined [Gitter](https://gitter.im/crystal-lang/crystal)/[IRC](http://webchat.freenode.net/?channels=#crystal-lang) or on [StackOverflow](http://stackoverflow.com/questions/tagged/crystal-lang).

# Submitting bugs
## Bug Report

Make sure to review these points before submitting issues - thank you!

- Make sure a similar issue doesn't exist yet: use the search box
- Make sure a similar issue does not exist yet: use the search box, search engine and look at [Stack Overflow](https://stackoverflow.com/questions/tagged/crystal-lang).
- **Include reproducible code**: we should be able to paste it into an editor, compile and run it and get the same error as you. Otherwise it's impossible for us to reproduce the bug.
- Don't **only** use `play.crystal-lang.org` or `carc.in`: code might be lost and the issue will remain incomplete. Write code in the issue itself.
- Reduce code, if possible, to the minimum size that reproduces the bug.
Expand Down
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: "\U00002753 Crystal Community Forum"
url: https://forum.crystal-lang.org/c/help-support
about: Questions about installing, using Crystal and any related issues.
- name: "\U0001F4AC Crystal Community Chat"
url: https://gitter.im/crystal-lang/crystal
about: "Get in touch with the community, ask for help and talk about Crystal. (IRC: #crystal-lang on freenode)"
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/discussion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: "\U0001F914 Language Improvement Discussion"
about: I want to start a new discussion about improving the language.
labels: status:discussion
---

## Discussion

- What aspect of the language would you like to see improved?
- What are the reasons?
- Include practical examples to illustrate your points.
- Optionally add one (or more) proposals to improve the current situation.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: "\U0001F680 Feature Request"
about: I want to propose a new language feature.
labels: kind:feature
---

## Feature Request

- Is your feature request related to a problem? Please describe clearly and concisely what is it.
- Describe the feature you would like, optionally illustrated by examples, and how it will solve the above problem.
- Describe considered alternative solutions, and the reasons why you have not proposed them as a solution here.
- Does it break backward compatibility, if yes then what's the migration path?
2 changes: 1 addition & 1 deletion .github/workflows/win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
linux-job:
runs-on: ubuntu-latest
container: crystallang/crystal:0.36.1-build
container: crystallang/crystal:1.0.0-build
steps:
- name: Download Crystal source
uses: actions/checkout@v2
Expand Down
114 changes: 114 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,117 @@
# 1.0.0 (2021-03-22)

## Language changes

- Support `Tuple#[](Range)` with compile-time range literals. ([#10379](https://github.com/crystal-lang/crystal/pull/10379), thanks @HertzDevil)

### Macros

- Don't use named argument key names as parameters for `method_missing` calls. ([#10388](https://github.com/crystal-lang/crystal/pull/10388), thanks @HertzDevil)

## Standard library

- **(breaking-change)** Drop deprecated definitions. ([#10386](https://github.com/crystal-lang/crystal/pull/10386), thanks @bcardiff)
- Fix example codes in multiple places. ([#10505](https://github.com/crystal-lang/crystal/pull/10505), thanks @maiha)

### Macros

- **(breaking-change)** Always add explicit return types in getter/property macros. ([#10405](https://github.com/crystal-lang/crystal/pull/10405), thanks @Sija)

### Numeric

- **(breaking-change)** Change default rounding mode to `TIES_EVEN`. ([#10508](https://github.com/crystal-lang/crystal/pull/10508), thanks @straight-shoota)
- Fix downcasting float infinity. ([#10420](https://github.com/crystal-lang/crystal/pull/10420), thanks @straight-shoota)
- Fix `String#to_f` out of range behaviour. ([#10425](https://github.com/crystal-lang/crystal/pull/10425), thanks @straight-shoota)
- Implement rounding mode for `Number#round`. ([#10413](https://github.com/crystal-lang/crystal/pull/10413), [#10360](https://github.com/crystal-lang/crystal/pull/10360), [#10479](https://github.com/crystal-lang/crystal/pull/10479), thanks @straight-shoota)

### Text

- Add missing unicode whitespace support to `String` methods. ([#10367](https://github.com/crystal-lang/crystal/pull/10367), thanks @straight-shoota)

### Collections

- Fix `Range#==` to ignore generic type arguments. ([#10309](https://github.com/crystal-lang/crystal/pull/10309), thanks @straight-shoota)
- Make `Enumerable#flat_map`, `Iterator#flat_map` work with mixed element types. ([#10329](https://github.com/crystal-lang/crystal/pull/10329), thanks @HertzDevil)
- Remove duplicated `sort` related specs. ([#10208](https://github.com/crystal-lang/crystal/pull/10208), thanks @MakeNowJust)
- Fix docs regarding `Set#each` return type. ([#10477](https://github.com/crystal-lang/crystal/pull/10477), thanks @kachick)
- Fix docs examples regarding `Set#*set_of?`. ([#10285](https://github.com/crystal-lang/crystal/pull/10285), thanks @oddp)
- Fix expectation on set specs. ([#10482](https://github.com/crystal-lang/crystal/pull/10482), thanks @kachick)

### Serialization

- **(breaking-change)** Serialize `Enum` to underscored `String` by default. ([#10431](https://github.com/crystal-lang/crystal/pull/10431), thanks @straight-shoota, @caspiano)
- **(breaking-change)** Use class instead of struct for types in XML module. ([#10436](https://github.com/crystal-lang/crystal/pull/10436), thanks @hugopl)
- Add `YAML::Nodes::Node#kind`. ([#10432](https://github.com/crystal-lang/crystal/pull/10432), thanks @straight-shoota)

### Files

- Let `IO::Memory` not be writable with read-only `Slice`. ([#10391](https://github.com/crystal-lang/crystal/pull/10391), thanks @straight-shoota)
- Allow `Int64` values within `IO#read_at`. ([#10356](https://github.com/crystal-lang/crystal/pull/10356), thanks @Blacksmoke16)
- Add `IO::Sized#remaining=(value)` to reuse an existing instance. ([#10520](https://github.com/crystal-lang/crystal/pull/10520), thanks @jgaskins)

### Networking

- **(security)** Remove Cookie Name Decoding. ([#10442](https://github.com/crystal-lang/crystal/pull/10442), thanks @security-curious)
- **(breaking-change)** Remove implicit en-/decoding for cookie values. ([#10485](https://github.com/crystal-lang/crystal/pull/10485), thanks @straight-shoota)
- **(breaking-change)** Split `HTTP::Cookies.from_headers` into separate methods for server/client. ([#10486](https://github.com/crystal-lang/crystal/pull/10486), thanks @straight-shoota)
- **(performance)** Minor performance improvements to `HTTP::Cookies`. ([#10488](https://github.com/crystal-lang/crystal/pull/10488), thanks @straight-shoota)
- Respect subclasses when constructing `HTTP::Client` from class methods. ([#10375](https://github.com/crystal-lang/crystal/pull/10375), thanks @oprypin)
- Make the `content-length` header more RFC compliant. ([#10353](https://github.com/crystal-lang/crystal/pull/10353), thanks @Blacksmoke16)
- Fix `#respond_with_status` when headers written or closed. ([#10415](https://github.com/crystal-lang/crystal/pull/10415), thanks @straight-shoota)
- Fix `Cookie#==` to take all ivars into account. ([#10487](https://github.com/crystal-lang/crystal/pull/10487), thanks @straight-shoota)
- Remove implicit `path=/` from `HTTP::Cookie`. ([#10491](https://github.com/crystal-lang/crystal/pull/10491), thanks @straight-shoota)
- Add `HTTP::Request#local_address`. ([#10385](https://github.com/crystal-lang/crystal/pull/10385), thanks @carlhoerberg)

### Logging

- Close `AsyncDispatcher` on `#finalize`. ([#10390](https://github.com/crystal-lang/crystal/pull/10390), thanks @straight-shoota)

### System

- Fix `Process.parse_argument` behavior against a quote in a word. ([#10337](https://github.com/crystal-lang/crystal/pull/10337), thanks @MakeNowJust)
- Add aarch64 support for macOS/darwin targets. ([#10348](https://github.com/crystal-lang/crystal/pull/10348), thanks @maxfierke, @RomainFranceschini)
- Add `LibC::MAP_ANONYMOUS` to x86_64-darwin to match other platforms. ([#10398](https://github.com/crystal-lang/crystal/pull/10398), thanks @sourgrasses)

### Runtime

- Improve error message for ELF reader on uninitialized runtime. ([#10282](https://github.com/crystal-lang/crystal/pull/10282), thanks @straight-shoota)

## Compiler

- **(breaking-change)** Disallow surrogate halves in escape sequences of string and character literals, use `\x` for arbitrary binary values. ([#10443](https://github.com/crystal-lang/crystal/pull/10443), thanks @HertzDevil)
- Fix ICE when exhaustive in-clause calls pseudo-method. ([#10382](https://github.com/crystal-lang/crystal/pull/10382), thanks @HertzDevil)
- Fix ICE when parsing `foo.%` calls. ([#10351](https://github.com/crystal-lang/crystal/pull/10351), thanks @MakeNowJust)
- Fix edge cases for symbol quoting rules. ([#10389](https://github.com/crystal-lang/crystal/pull/10389), thanks @HertzDevil)
- Support closured vars inside `Const` initializer. ([#10478](https://github.com/crystal-lang/crystal/pull/10478), thanks @RX14)
- Documentation grammar fix. ([#10369](https://github.com/crystal-lang/crystal/pull/10369), thanks @szTheory)

### Language semantics

- Don't fail on untyped `is_a?`. ([#10320](https://github.com/crystal-lang/crystal/pull/10320), thanks @asterite)
- Fix named arguments in `super` and `previous_def` calls. ([#10400](https://github.com/crystal-lang/crystal/pull/10400), thanks @HertzDevil)
- Fix assignments in array literals. ([#10009](https://github.com/crystal-lang/crystal/pull/10009), thanks @straight-shoota)
- Consider type var splats in generic type restrictions. ([#10168](https://github.com/crystal-lang/crystal/pull/10168), thanks @HertzDevil)
- Align `Proc.new(&block)`'s behaviour with other captured blocks. ([#10263](https://github.com/crystal-lang/crystal/pull/10263), thanks @HertzDevil)
- Don't merge `NamedTuple` metaclasses through instance types. ([#10501](https://github.com/crystal-lang/crystal/pull/10501), thanks @HertzDevil)
- Access instantiations of `NamedTuple` and other generics uniformly. ([#10401](https://github.com/crystal-lang/crystal/pull/10401), thanks @HertzDevil)
- Improve error message for auto-cast error at Var assign. ([#10327](https://github.com/crystal-lang/crystal/pull/10327), thanks @straight-shoota)
- Exclude abstract defs from "no overload matches" errors. ([#10483](https://github.com/crystal-lang/crystal/pull/10483), thanks @HertzDevil)
- Support splats inside tuple literals in type names. ([#10430](https://github.com/crystal-lang/crystal/pull/10430), thanks @HertzDevil)
- Accept pointer instance types on falsey conditional branches. ([#10464](https://github.com/crystal-lang/crystal/pull/10464), thanks @HertzDevil)
- Match named arguments by external parameter names when checking overload cover. ([#10530](https://github.com/crystal-lang/crystal/pull/10530), thanks @HertzDevil)

### Doc generator

- Detect source locations in more situations. ([#10439](https://github.com/crystal-lang/crystal/pull/10439), thanks @oprypin)

## Others

- CI improvements and housekeeping. ([#10299](https://github.com/crystal-lang/crystal/pull/10299), [#10340](https://github.com/crystal-lang/crystal/pull/10340), [#10476](https://github.com/crystal-lang/crystal/pull/10476), [#10480](https://github.com/crystal-lang/crystal/pull/10480), thanks @bcardiff, @Sija, @straight-shoota)
- Update distribution-scripts to use Shards v0.14.1. ([#10494](https://github.com/crystal-lang/crystal/pull/10494), thanks @bcardiff)
- Add GitHub issue templates. ([#8934](https://github.com/crystal-lang/crystal/pull/8934), thanks @j8r)
- Add LLVM 11.1 to the list of supported versions. ([#10523](https://github.com/crystal-lang/crystal/pull/10523), thanks @Sija)
- Fix SDL examples crashes. ([#10470](https://github.com/crystal-lang/crystal/pull/10470), thanks @megatux)

# 0.36.1 (2021-02-02)

## Standard library
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Oh, and we don't want to write C code to make the code run faster.
Project Status
--------------

Crystal is still under heavy development. There can be breaking changes but we're trying to keep them as minimum as possible.
Within a major version language features won't be removed or changed in any way that could prevent an existing code to keep compiling and working. And the built in standard library might be enriched but always with backward compatibility in mind.

The development is possible thanks to the community's effort and the continued support of [84codes](https://www.84codes.com/), [Nikola Motor Company](https://nikolamotor.com/) and every other [sponsor](https://crystal-lang.org/sponsors).

Expand Down
25 changes: 22 additions & 3 deletions bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,30 @@ format() {
prepare_build() {
on_linux verify_linux_environment

on_osx curl -L https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-darwin-x86_64.tar.gz -o ~/crystal.tar.gz
on_osx 'pushd ~;gunzip -c ~/crystal.tar.gz | tar xopf -;mv crystal-0.36.1-1 crystal;popd'
on_osx curl -L https://github.com/crystal-lang/crystal/releases/download/1.0.0/crystal-1.0.0-1-darwin-x86_64.tar.gz -o ~/crystal.tar.gz
on_osx 'pushd ~;gunzip -c ~/crystal.tar.gz | tar xopf -;mv crystal-1.0.0-1 crystal;popd'

# These commands may take a few minutes to run due to the large size of the repositories.
# This restriction has been made on GitHub's request because updating shallow
# clones is an extremely expensive operation due to the tree layout and
# traffic of Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do
# this for you automatically to avoid repeatedly performing an expensive
# unshallow operation in CI systems (which should instead be fixed to not use
# shallow clones). Sorry for the inconvenience!
on_osx git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
on_osx git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

on_osx brew update --preinstall
on_osx brew bundle --no-lock

# Install a recent bash version for nix-shell.
# macos ships with an ancient one.
if [ `uname` = "Darwin" ]; then
on_nix_shell "brew install bash"
fi
# initialize nix environment
on_nix_shell nix-shell

# Note: brew link --force might show:
# Warning: Refusing to link macOS-provided software: llvm
#
Expand Down Expand Up @@ -168,7 +187,7 @@ with_build_env() {

on_linux verify_linux_environment

export DOCKER_TEST_PREFIX="${DOCKER_TEST_PREFIX:=crystallang/crystal:0.36.1}"
export DOCKER_TEST_PREFIX="${DOCKER_TEST_PREFIX:=crystallang/crystal:1.0.0}"

case $ARCH in
x86_64)
Expand Down
2 changes: 1 addition & 1 deletion samples/sdl/fire.cr
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class Screen
end

def put_pixel(point, color)
color = color.to_u32
color = color.to_u32!
offset = @surface.offset(point.x, point.y)
@surface[offset] = color

Expand Down
2 changes: 1 addition & 1 deletion samples/sdl/sdl/surface.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SDL::Surface
end

def []=(offset, color)
(@surface.value.pixels.as(UInt32*))[offset] = color.to_u32
(@surface.value.pixels.as(UInt32*))[offset] = color.to_u32!
end

def []=(x, y, color)
Expand Down
46 changes: 25 additions & 21 deletions samples/sdl/tv.cr
Original file line number Diff line number Diff line change
Expand Up @@ -130,34 +130,38 @@ color_maker = ColorMaker.new(delay)
rects = parse_rectangles
puts "Rects: #{rects.size}"

while true
SDL.poll_events do |event|
if event.type == LibSDL::QUIT || event.type == LibSDL::KEYDOWN
ms = SDL.ticks - start
puts "#{frames} frames in #{ms} ms"
puts "Average FPS: #{frames / (ms * 0.001)}"
SDL.quit
exit
begin
while true
SDL.poll_events do |event|
if event.type == LibSDL::QUIT || event.type == LibSDL::KEYDOWN
ms = SDL.ticks - start
puts "#{frames} frames in #{ms} ms"
puts "Average FPS: #{frames / (ms * 0.001)}"
SDL.quit
exit
end
end
end

surface.lock
surface.lock

(height // 10).times do |h|
(width // 10).times do |w|
rect = rects.find { |rect| rect.contains?(w, h) }
10.times do |y|
10.times do |x|
surface[x + 10 * w, y + 10 * h] = rect ? (rect.light? ? color_maker.light_color : color_maker.dark_color) : color_maker.black_color
(height // 10).times do |h|
(width // 10).times do |w|
rect = rects.find { |rect| rect.contains?(w, h) }
10.times do |y|
10.times do |x|
surface[x + 10 * w, y + 10 * h] = rect ? (rect.light? ? color_maker.light_color : color_maker.dark_color) : color_maker.black_color
end
end
end
end
end

color_maker.next
color_maker.next

surface.unlock
surface.flip
surface.unlock
surface.flip

frames += 1
frames += 1
end
ensure
SDL.quit
end
12 changes: 6 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ let
# Hashes obtained using `nix-prefetch-url --unpack <url>`
latestCrystalBinary = genericBinary ({
x86_64-darwin = {
url = "https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-darwin-x86_64.tar.gz";
sha256 = "sha256:0596aind8mlg65g99zhd9r1bic8scs5j6262xnh43r3fracw00lj";
url = "https://github.com/crystal-lang/crystal/releases/download/1.0.0/crystal-1.0.0-1-darwin-x86_64.tar.gz";
sha256 = "sha256:1ff05f7v31r7xw4xk1a5zns77k3hrgdb9cn15w2zsps83iqlq81i";
};

x86_64-linux = {
url = "https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-linux-x86_64.tar.gz";
sha256 = "sha256:1vpxm0zw5nbfl0pxl3gsm622958fqlwf71q2gm73avwj8kmhwsx6";
url = "https://github.com/crystal-lang/crystal/releases/download/1.0.0/crystal-1.0.0-1-linux-x86_64.tar.gz";
sha256 = "sha256:13940gjs1zl29wrhngzylhckxgzb8xh16bniqik5lslp6qpljqy4";
};

i686-linux = {
url = "https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-linux-i686.tar.gz";
sha256 = "sha256:0a1x7w6690dhsjl9bdin1z79bx59ch5w0am1snn3bnjdpc1zbnbs";
url = "https://github.com/crystal-lang/crystal/releases/download/1.0.0/crystal-1.0.0-1-linux-i686.tar.gz";
sha256 = "sha256:18xg2nxg68cx0ngidpzy68wa5zqmcz0xfm0im5sg8j8bnj8ccg35";
};
}.${pkgs.stdenv.system});

Expand Down
Loading

0 comments on commit 6427b47

Please sign in to comment.