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

all: Fix len func and improve errors #197

Merged
merged 2 commits into from
Sep 5, 2023
Merged

all: Fix len func and improve errors #197

merged 2 commits into from
Sep 5, 2023

Conversation

juliaogris
Copy link
Member

  • Fix built-in len function for strings, especially for emojis
  • Improve ErrVarNotSet error if funcs use variables that have not yet
    been declared at call site.

@github-actions
Copy link

github-actions bot commented Sep 5, 2023

firebase-deployment: https://evy-lang--197-m8nqw7ze.web.app (85852d7)

Copy link
Member

@camh- camh- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐸 with a couple of quibbling comments

pkg/evaluator/evaluator.go Outdated Show resolved Hide resolved
pkg/evaluator/evaluator_test.go Outdated Show resolved Hide resolved
Improve ErrVarNotSet error by changing it from an internal error to a
runtime panic as there are legitimate ways in which to parse code that
then runs using an unset variable. The new testcase covers this. While
at it improve the error message and location where the error is
reported.
Fix built-in len function for strings to use rune code, rather than
bytes count. That means `len "✨"` now returns 1, rather than 3. However
certain emojis are graphemes/clusters and still return counts greater
than one such as flags or skin-coloured emojis.
@juliaogris juliaogris merged commit db04c2a into master Sep 5, 2023
3 checks passed
@juliaogris juliaogris deleted the fix-len-string branch September 5, 2023 12:29
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

Successfully merging this pull request may close these issues.

2 participants