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

[FEATURE] "No overload matches" output confusing #8179

Closed
didactic-drunk opened this issue Sep 13, 2019 · 3 comments
Closed

[FEATURE] "No overload matches" output confusing #8179

didactic-drunk opened this issue Sep 13, 2019 · 3 comments

Comments

@didactic-drunk
Copy link
Contributor

Problem:

  • It's hard to pick which argument has the wrong type with lots of overloads or lots arguments.

Example:

Error: no overload matches 'Sodium::Cipher::Aead::Xchacha20Poly1305Ietf#decrypt_detached'
 with types Slice(UInt8), nonce: Sodium::Nonce, mac: Slice(UInt8), additional: String

Overloads are:
 - Sodium::Cipher::Aead::Xchacha20Poly1305Ietf#decrypt_detached(src : Bytes,
 - - dst : Bytes | ::Nil = nil, *, nonce : Nonce, 
 - - mac : Bytes, additional : Bytes | ::Nil = nil)
 - Sodium::Cipher::Aead::Chalsa#decrypt_detached(data, 
 - - dst : Bytes | ::Nil = nil, *, 
 - - mac : Bytes | ::Nil = nil, additional = nil)

Feature request:

  • Colorize the output for matching and nonmatching types to quickly see which types are incorrect.
@straight-shoota
Copy link
Member

Colorize could help, but only when color is supported (for example on a TTY).

A good improvement would probably already be when we get the types at call site and the overloads formatted in the same way, using a proper crystal format style. This would make it easier to read the signatures and help compare them.

Additionally, it would be super great if matching arguments could be lined up similarly. This should work great for short signatures. But as soon as there are many arguments which span multiple lines and optional arguments not present everywhere, this becomes super complicated.

Example for a relatively simple set of overloads:

Call:
- foo(String,                             c: Nil)

Overloads are:
 - foo(a : String,         b : Int32 = 0, c : Bool = true)
 - foo(a : String,         b : Float64,   c : Bool = false)
 - foo(a : String,         b : Int64,     c : Bool)
 - foo(a : Time::Location, b,             c : Nil)

@didactic-drunk
Copy link
Contributor Author

The class and method name take a lot of horizontal space. Show it once?
Sodium::Cipher::Aead::Xchacha20Poly1305Ietf#decrypt_detached

@straight-shoota
Copy link
Member

Closing as duplicate of #11106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants