feat: add MAX_VARIABLE_NAME limit and improve field overflow error message
Add a 64-character maximum identifier length with compile-time error reporting, and enhance the runtime field overflow error to include the class name and remove the TODO comment. Update test expectations for both limit scenarios.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
var i234567890i234567890i234567890i234567890i234567890i2345 = "value" // expect error
|
||||
class c234567890c234567890c234567890c234567890c234567890c234567890c2345 {} // expect error
|
||||
Reference in New Issue
Block a user