Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when requiring "clear" in Crystal 1.1.1 #219

Open
Lunari8546 opened this issue Jul 29, 2021 · 7 comments
Open

Error when requiring "clear" in Crystal 1.1.1 #219

Lunari8546 opened this issue Jul 29, 2021 · 7 comments

Comments

@Lunari8546
Copy link

I'm using Crystal 1.1.1 and when I require "clear" I got this error.

In lib/clear/src/clear/sql/insert_query.cr:61:10

 61 | h[col] = rs.read
       ^
Error: no overload matches 'Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=' with types String, (Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) 
| Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Bool | Char | Float32 | Float64 | Int16 | Int32 | Int64 | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt32 | UUID | Nil)

Overloads are:
 - Hash(K, V)#[]=(key : K, value : V)
Couldn't find overloads for these types:
 - Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=(key : String, value : JSON::PullParser)

Here's my shard.lock :

version: 2.0
shards:
  admiral:
    git: https://github.com/jwaldrip/admiral.cr.git
    version: 1.12.1

  clear:
    git: https://github.com/anykeyh/clear.git
    version: 0.9+git.commit.775e877c4f961da01fa621ae7ca302cb735198df

  db:
    git: https://github.com/crystal-lang/crystal-db.git
    version: 0.10.1

  exception_page:
    git: https://github.com/crystal-loot/exception_page.git
    version: 0.1.5

  generate:
    git: https://github.com/anykeyh/generate.cr.git
    version: 0.1.0+git.commit.f5dafc934a70e0ee2f246dddf3df44686f844da2

  graphql:
    git: https://github.com/graphql-crystal/graphql.git
    version: 0.3.1

  inflector:
    git: https://github.com/anykeyh/inflector.cr.git
    version: 0.1.8+git.commit.dc5c898b0a834617d8b3ff73ac5a2239bd9fc019

  kemal:
    git: https://github.com/kemalcr/kemal.git
    version: 1.0.0

  kilt:
    git: https://github.com/jeromegn/kilt.git
    version: 0.4.1

  pg:
    git: https://github.com/will/crystal-pg.git
    version: 0.24.0

  radix:
    git: https://github.com/luislavena/radix.git
    version: 0.4.1
@straight-shoota
Copy link
Contributor

This looks like #190 but that should be fixed with clear 0.9.0.

@Vici37
Copy link
Contributor

Vici37 commented Aug 2, 2021

I'm getting the same error and think it's actually coming from this recent change to pg. In my local fork of clear, adding JSON::PullParser to the Clear::SQL::Any type (here) fixes the compiler errors, but I'm getting errors when running tests (which can very much be due to incorrect environment set up, I haven't dug very far yet). Posting this here in case I don't find time to finish digging into this and submitting a PR.

@Vici37
Copy link
Contributor

Vici37 commented Aug 2, 2021

Ah, did find time tonight to track down the remaining issues. Created PR: #220

@kostya
Copy link

kostya commented Mar 12, 2022

same error: crystal 1.3.2

  clear:
    git: https://github.com/anykeyh/clear.git
    version: 0.9+git.commit.480289555c833793fa6964398fefec6b7e25168d

require clear

Showing last frame. Use --error-trace for full trace.

In lib/clear/src/clear/sql/insert_query.cr:61:10

 61 | h[col] = rs.read
       ^
Error: no overload matches 'Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=' with types String, (Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | Array(PG::UUIDArray) | Bool | Char | Float32 | Float64 | Int16 | Int32 | Int64 | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt32 | UUID | Nil)                                                 

Overloads are:
 - Hash(K, V)#[]=(key : K, value : V)
Couldn't find overloads for these types:
 - Hash(String, Array(JSON::Any) | Array(PG::BoolArray) | Array(PG::CharArray) | Array(PG::Float32Array) | Array(PG::Float64Array) | Array(PG::Int16Array) | Array(PG::Int32Array) | Array(PG::Int64Array) | Array(PG::NumericArray) | Array(PG::StringArray) | Array(PG::TimeArray) | BigDecimal | Bool | Char | Clear::Expression::UnsafeSql | Float32 | Float64 | Hash(String, JSON::Any) | Int16 | Int32 | Int64 | Int8 | JSON::Any | JSON::PullParser | PG::Geo::Box | PG::Geo::Circle | PG::Geo::Line | PG::Geo::LineSegment | PG::Geo::Path | PG::Geo::Point | PG::Geo::Polygon | PG::Interval | PG::Numeric | Slice(UInt8) | String | Time | UInt16 | UInt32 | UInt64 | UInt8 | UUID | Nil)#[]=(key : String, value : Array(PG::UUIDArray))

@kostya
Copy link

kostya commented Mar 12, 2022

Actually fixed if i freeze pg, with such yml it works.

  clear:
    github: anykeyh/clear
    branch: master
  pg:
    github: will/crystal-pg
    version: 0.24.0

@Vici37
Copy link
Contributor

Vici37 commented Mar 12, 2022

I have a fix for this change in my own fork here: https://github.com/Vici37/clear

You can temporarily use it instead of freezing pg in your shards.yml via:

  clear:
    github: Vici37/clear
    branch: master

Once #220 #225 gets merged into this repo, it's safe to swap this back (I try to keep my own fork's master branch up to date as well, though).

@jkthorne
Copy link

jkthorne commented Apr 8, 2023

any update on this issue?

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

No branches or pull requests

5 participants