liquid-java / liquid-java/liquidjava

State Names should be able to start with UpperCase

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Java
Stars
67
Forks
36
Avg merge
10d 18h
Merged PRs (30d)
3

Description

Why

There is some confusion about what can be written in uppercase and lowercase, and we only defined that in the Grammar.

During the user study, some participants started writing the state names capitalized (i.e., first letter Upper Case and the remaining in lower case). However, the current grammar does not allow it since capitalization is reserved for Alias.

Maybe it would make sense to allow both types to be capitalized specially since we got different annotation for each that serve as syntax sugar but help desambiguate.

Example

@StateSet({"Uninitialized", "Initialized"})
public class SM1 {

	@StateRefinement(to="Uninitialized(this)")
	public SM1() {}
	

	@StateRefinement(from="Uninitialized(this)", to="Initialized(this)")
	public void initialize() {}
}
...
	public static void main(String[] args) {
		SM1 sm1 = new SM1();
		sm1.initialize(); //Error
	}

The states are capitalized so they are handled as alias which should not be the correct behavior.

Steps

  1. Allow in the grammar that states can be capital (confirm if it is needed).
  2. When parsing the refinements AST make sure the capitalized states are treated as such and not as alias.
  3. Test with examples.

Current Approach

Check if any of the state names provided starts with uppercase - if so, immediately return with an error.

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.

Research direction

Start by locating the grammar and the refinements AST parser, then trace how capitalized state names are currently classified as aliases. Run the examples described in the issue and add or update tests covering both capitalized states and aliases. Done means valid capitalized state names parse as states without breaking alias handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.