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 message around <bytes>.decode(...) mention hilti::Charset #1803

Open
awelzel opened this issue Jul 17, 2024 · 1 comment
Open

Error message around <bytes>.decode(...) mention hilti::Charset #1803

awelzel opened this issue Jul 17, 2024 · 1 comment

Comments

@awelzel
Copy link
Contributor

awelzel commented Jul 17, 2024

I thought there were some changes that hilti::Charset isn't supposed to be used anymore. Two observations:

  1. Mistakenly typing bytes.decode("utf-8") shows a lot of hilti::Charset for me:
[error] ldap/ldap.spicy:987:53-987:70: call does not match any method: <bytes>.decode(<string>)
[error] ldap/ldap.spicy:987:53-987:70:   candidates:
[error] ldap/ldap.spicy:987:53-987:70:   - <bytes>.decode([charset: hilti::Charset = hilti::Charset::UTF8], [errors: hilti::DecodeErrorStrategy = hilti::DecodeErrorStrategy::REPLACE])
  1. It seems import hilti works still?
$ cat h.spicy 
module Test;

import hilti;

print b"abc".decode(hilti::Charset::UTF8);
$ spicyc -j h.spicy -o h.hlto
$ spicyc --version
spicyc v1.11.0-dev.262 (4a1b43ef)

Am I confused? :-)

@rsmmr
Copy link
Member

rsmmr commented Jul 22, 2024

Both of these are a result of the layering, where things get lowered from Spicy to HILTI internally, and doing "HILTI stuff" ends up working as well, and error messages may be produced at the HILTI level (where spicy::Charset has turned into hilti::Charset). But yeah, we should try to make this nicer.

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