mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
Better error message on too many inherited fields.
This commit is contained in:
2
test/limit/long_variable_name.wren
Normal file
2
test/limit/long_variable_name.wren
Normal file
@ -0,0 +1,2 @@
|
||||
var i234567890i234567890i234567890i234567890i234567890i234 = "value"
|
||||
class c234567890c234567890c234567890c234567890c234567890c234567890c234 {}
|
||||
@ -136,7 +136,7 @@ class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
class Bar is Foo { // expect runtime error: A class may not have more than 255 fields, including inherited ones.
|
||||
class Bar is Foo {
|
||||
new {
|
||||
super
|
||||
_field129 = 129
|
||||
@ -266,15 +266,16 @@ class Bar is Foo { // expect runtime error: A class may not have more than 255 f
|
||||
_field253 = 253
|
||||
_field254 = 254
|
||||
_field255 = 255
|
||||
_field256 = 256
|
||||
}
|
||||
|
||||
bar {
|
||||
IO.print(_field129)
|
||||
IO.print(_field256)
|
||||
IO.print(_field255)
|
||||
}
|
||||
}
|
||||
|
||||
var bar = new Bar
|
||||
bar.foo
|
||||
bar.bar
|
||||
bar.foo // expect: 1
|
||||
// expect: 128
|
||||
bar.bar // expect: 129
|
||||
// expect: 255
|
||||
|
||||
@ -136,7 +136,7 @@ class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
class Bar is Foo {
|
||||
class Bar is Foo { // expect runtime error: Class 'Bar' may not have more than 255 fields, including inherited ones.
|
||||
new {
|
||||
super
|
||||
_field129 = 129
|
||||
@ -266,16 +266,15 @@ class Bar is Foo {
|
||||
_field253 = 253
|
||||
_field254 = 254
|
||||
_field255 = 255
|
||||
_field256 = 256
|
||||
}
|
||||
|
||||
bar {
|
||||
IO.print(_field129)
|
||||
IO.print(_field255)
|
||||
IO.print(_field256)
|
||||
}
|
||||
}
|
||||
|
||||
var bar = new Bar
|
||||
bar.foo // expect: 1
|
||||
// expect: 128
|
||||
bar.bar // expect: 129
|
||||
// expect: 255
|
||||
bar.foo
|
||||
bar.bar
|
||||
|
||||
2
test/limit/variable_name_too_long.wren
Normal file
2
test/limit/variable_name_too_long.wren
Normal file
@ -0,0 +1,2 @@
|
||||
var i234567890i234567890i234567890i234567890i234567890i2345 = "value" // expect error
|
||||
class c234567890c234567890c234567890c234567890c234567890c234567890c2345 {} // expect error
|
||||
Reference in New Issue
Block a user