-
Notifications
You must be signed in to change notification settings - Fork 65
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
Crash on var assignment of parameter with the same name #313
Comments
Actually it is worse and the following what I thought was correct code fails too:
|
You can't name a var or val field the same as a method.
But of course the typechecker should give a good error message rather than
an exception--thanks for reporting this.
…On Wed, Mar 20, 2019 at 8:06 PM potanin ***@***.***> wrote:
Actually it is worse and the following what I thought was correct code
fails too:
type Pair
type T
def first():this.T
def second():this.T
def makeIntPair(f:Int, s:Int):Pair[Int] = new
type T = Int
var first:Int = f
var second:Int = s
def first():this.T = this.first
def second():this.T = this.second
def print():Unit
stdout.print("First: ")
stdout.printInt(this.first)
stdout.println()
stdout.print("Second: ")
stdout.printInt(this.second)
stdout.println()
var pair1:Pair[Int] = makeIntPair(3, 2)
var pair2:Pair[Int] = makeIntPair(4, 5)
pair1.print()
pair2.print()
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#313 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACO6nUsMjzBXPBM06SDgxVJ78y1o-gbDks5vYszzgaJpZM4cAf21>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following throws a RuntimeException (possibly due to scoping of
var
/val
's).I attached a txt file because silly GitHub does not allow attaching source files like .wyv or wyt - is there a setting we can fix?
bug.wyv.txt
The text was updated successfully, but these errors were encountered: