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

The error message is misleading when setting too many attributes #3542

Closed
yegor256 opened this issue Nov 24, 2024 · 1 comment · Fixed by #3932
Closed

The error message is misleading when setting too many attributes #3542

yegor256 opened this issue Nov 24, 2024 · 1 comment · Fixed by #3932

Comments

@yegor256
Copy link
Member

Consider this code:

sprintf
  "Hello, %s, your salary is %d"
  "Jeff"
  42

This will lead to error:

Can't overwrite the "λ" attribute

It's a very weird and misleading message. Apparently, it happens because sprintf doesn't have three void attributes, but only two. The right code is this:

sprintf
  "Hello, %s, your salary is %d"
  *
    "Jeff"
    42

I suggest adding this test method to PhDefaultTest:

    @Test
    void failsCorrectlyWhenTooManyAttributesPut() {
        MatcherAssert.assertThat(
            "the message explains what's going on",
            Assertions.assertThrows(
                ExAbstract.class,
                () -> new EOnumber().put(1, new Data.ToPhi(1)),
                "fails when trying to set attribute with too big position"
            ).getMessage(),
            Matchers.equalTo("there are no void attributes left, can't set the 1st one")
        );
    }

Let's make it pass.

@yegor256
Copy link
Member Author

@maxonfjvipon can you help?

Suban05 added a commit to Suban05/eo that referenced this issue Feb 18, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 19, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 19, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 19, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 21, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 21, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 21, 2025
Suban05 added a commit to Suban05/eo that referenced this issue Feb 21, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 21, 2025
#3542 output a clearer message when too many attributes are passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant