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

Multiple method bodies raises warning 49 but should not if body has no extra code #1488

Open
TimLethbridge opened this issue Aug 13, 2019 · 0 comments

Comments

@TimLethbridge
Copy link
Member

commented Aug 13, 2019

Only one method body is allowed in a method (per language). However in the following code m1 has three separate declarations and all three are legitimate since the last two introduce only constraints. If a method block only adds constraints or testcases (etc.) i.e. no new executable code, then warning 49 should be suppressed. This will allow, among other things, separate mixins with different constraints, and separation of testcases from the main declaration of the method.

class X {
  Integer age;
  m1 () {
      // test1
  }

    m1 () {
       [pre: age >= 18]  
  }
      m1 () {
       [pre: age <= 99]  
  }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.