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

Improve error message for scalar types in refinements #383

Closed
senier opened this issue Aug 2, 2020 · 2 comments
Closed

Improve error message for scalar types in refinements #383

senier opened this issue Aug 2, 2020 · 2 comments

Comments

@senier
Copy link
Member

senier commented Aug 2, 2020

package Test is
   type Length is mod 2**16;
   type Address is mod 2**32;

   type Message is
      message
         Length : Length
            then Data
               with Length => 8 * Length;
         Data : Opaque;
      end message;

   for Message use (Data => Address)
      if Length = 17;                                                                                                                                                         
end Test;

Using a scalar type in a refinement, yields the following error:

Parsing test.rflx
Processing Test
test.rflx:13:29: parser: error: undefined type "Test.Address" in refinement of "Test.Message"

We should either support that or at least emit a better error message (stating that the type was found, but is not suitable).

@senier senier created this issue from a note in RecordFlux 0.5 (To do) Aug 2, 2020
@treiher
Copy link
Collaborator

treiher commented Aug 4, 2020

The scalar type could be wrapped in a message to make such a refinement possible. As there is no concrete use case, I don't think it would be worth the effort to support this special case. We should just improve the error message.

@treiher treiher changed the title Support scalar types in refinements Improve error message for scalar types in refinements Aug 4, 2020
@treiher treiher removed this from To do in RecordFlux 0.5 Jan 21, 2021
@treiher treiher added this to To do in RecordFlux 0.7 via automation Jan 21, 2021
@senier senier removed this from To do in RecordFlux 0.7 Aug 23, 2022
@senier senier added this to To do in RecordFlux Future via automation Aug 23, 2022
@treiher
Copy link
Collaborator

treiher commented Apr 23, 2024

The error message is improved in version 0.21.0.

@treiher treiher closed this as completed Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

2 participants