Improve error message for `log`

Open Beginner friendly
#4,306 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
compilers

Research direction

Reproduce the issue with the provided Console interface and trace the parser's handling of log as a reserved name. Add a regression test for this input and verify that the diagnostic identifies log as reserved for events instead of reporting only invalid syntax.

Written by the indexing model from the issue text.

Description

bug - UX

We should improve the error message if log is used (reserved due to events):

interface Console:
    def log(str: String[400], x: uint256): view
invalid syntax (<unknown>, line 21)

  line 21:9 
       20 interface Console:
  ---> 21     def log(str: String[400], x: uint256): view
  -----------------^
       22

Something like this would be better:

invalid syntax: `log` is a reserved keyword used for events.
Dominant language
Python
Stars
5.2k
Forks
914
Avg merge
3d 13h
Merged PRs (30d)
25

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vyperlang/vyper

All issues in vyperlang/vyper

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.