amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 206 forks source link

Amber is incompatible with crystal 0.36.x? #1245

Closed factyy closed 3 years ago

factyy commented 3 years ago

Description

Amber fails to build an empty app using crystal 0.36.x Reproducing both in host and docker environments (the following description is for a docker one)

Steps to Reproduce

  1. Get a crystal docker image docker pull crystallang/crystal:0.36.0 and create a container from it;
  2. Install amber from sources:
    git clone https://github.com/amberframework/amber.git
    cd amber
    make
    make install
  3. Generate a new minimal amber app:
    amber new --minimal .
  4. Run amber with amber w

Expected behavior: Amber app starts

Actual behavior: Amber app fails to build:

watch.run (Info) Building...
INFO - watch.run: Building...
Showing last frame. Use --error-trace for full trace.

In lib/amber/src/amber/router/session/cookie_store.cr:41:3

 41 | class CookieStore < AbstractStore
      ^
Error: abstract `def Amber::Router::Session::AbstractStore#update(other_hash)` must be implemented by Amber::Router::Session::CookieStore
INFO - watch.run: Compile time errors detected, exiting...
watch.run (Info) Compile time errors detected, exiting...

Reproduces how often: 100% reproduction with crystal 0.36.0 and 0.36.1

Versions

Crystal 0.36.0 [1e6f96aef] (2021-01-26)

LLVM: 10.0.0 Default target: x86_64-unknown-linux-gnu

Amber CLI (amberframework.org) - v0.35.0

Additional Information

I'm entirely new to crystal but it looks like a method with type constraints doesn't override the most generic one in the base class via inheritance. This particular error can be fixed by adding (to the base class) or removing (from CookieStore) type constraints from the method signature. But there are lots of errors like this in the generated code base, so it looks like it is not possible to eliminate all of them by hand without breaking something in the framework (touching the framework by hand is a pretty bad idea itself).

acook commented 3 years ago

The fix should be merged, however given that there hasn't been a fresh release of Amber since June I expect that you'll need to use the main branch version to get things to work.

factyy commented 3 years ago

Sadly I have to confirm that this problem exists with an up-to-day amber (master branch).

I've patched the description

acook commented 3 years ago

Oh, wow. Thanks for posting more info. I had tried to install Amber a few days ago and assumed it was a fairly simple issue.

Looks like there will need to be some deeper fixes in Amber to bring it up to date with the latest breaking changes. So, for a solution for you I would suggest: either roll back to an older version of Crystal or I'm sure the Amber project would love to have someone tackling these issues.

factyy commented 3 years ago

Currently I decided to stick with 0.35.1 but hopefully I will be able to help with such issues in the foreseeable future :)

drujensen commented 3 years ago

Released Amber 0.36.0 to support Crystal 0.36.x

renich commented 3 years ago

I'm getting this on a project created with v0.35.1 while trying amber w with a newly compiled v0.36.0

[renich@introdesk rafita]$ amber -v
Amber CLI (amberframework.org) - v0.36.0

[renich@introdesk rafita]$ amber w
11:13:54 watch.run (Info) Building...
2021-02-22T17:13:54.330479Z   INFO - watch.run: Building...
Showing last frame. Use --error-trace for full trace.

In lib/amber/src/amber/router/session/cookie_store.cr:41:3

 41 | class CookieStore < AbstractStore
      ^
Error: abstract `def Amber::Router::Session::AbstractStore#update(other_hash)` must be implemented by Amber::Router::Session::CookieStore
2021-02-22T17:13:55.910551Z   INFO - watch.run: Compile time errors detected, exiting...
11:13:55 watch.run (Info) Compile time errors detected, exiting...
renich commented 3 years ago

OK, the fix was kind of easy. I just deleted lib/*, updated shards.yml to the ones currently used and ran shards install again. After that, it worked.