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

duplicate instance variable definitions are not detected #1201

Open
telephon opened this issue Oct 11, 2014 · 3 comments
Open

duplicate instance variable definitions are not detected #1201

telephon opened this issue Oct 11, 2014 · 3 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"
Milestone

Comments

@telephon
Copy link
Member

The following class definition won't fail although it should:

Test {
    var variable;
    var variable;

}
@telephon telephon added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library" labels Oct 11, 2014
@scztt scztt added this to the 3.8 milestone Apr 12, 2015
@patrickdupuis
Copy link
Contributor

Tried this on 3.7.1 and got the following error:

ERROR: Class not defined.
  in file 'selected text'
  line 1 char 4:

  Test {

    var variable;
-----------------------------------
ERROR: Function variable 'variable' already declared in Interpreter:functionCompileContext
  in file 'selected text'
  line 3 char 14:

    var variable;

  } 
-----------------------------------

@jamshark70
Copy link
Contributor

Reopening. @patrickdupuis 's test was not valid. The code block in the issue description is a class definition, so the proper test is not to submit it interactively to the interpreter. You have to put it in a .sc file in your extension directory and recompile the library.

I did that test and Julian is correct -- the compiler reports no error.

Not fixed yet.

@jamshark70 jamshark70 reopened this Apr 13, 2016
@nhthn nhthn modified the milestones: 3.8, 3.9 Jan 15, 2017
@mossheim
Copy link
Contributor

Will look into this. Further test:

// TestClass.sc
TestClass {
  var <var1 = 2;
  var <var1 = 3;
}
// Interpreted code
TestClass.new.var1.postln; // prints '3'

There's a missing check somewhere.

@nhthn nhthn modified the milestones: 3.9, 3.9.x Oct 28, 2017
@mossheim mossheim removed their assignment Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"
Projects
None yet
Development

No branches or pull requests

7 participants