hcl/t/class-5001.err

301 lines
5.0 KiB
Plaintext
Raw Normal View History

class ##ERROR: syntax error - incomplete defintion of unnamed class for 'class'
2024-07-22 06:06:45 +00:00
---
class B ##ERROR: syntax error - incomplete definition of 'B' for 'class'
2024-07-22 06:06:45 +00:00
---
class B ( ##ERROR: syntax error - block expression expected as 'class' body
)
---
2024-09-18 13:21:11 +00:00
class B + ##ERROR: syntax error - prohibited binary selector '+'
2024-07-22 06:06:45 +00:00
---
class A {
var a
| j | ##ERROR: syntax error - variable declaration disallowed
2024-10-03 08:21:08 +00:00
}
---
class 10 { ##ERROR: syntax error - invalid class name '10' for 'class'
var a
2024-10-03 08:21:08 +00:00
}
---
class class { ##ERROR: syntax error - invalid class name 'class' for 'class'
}
---
class super.a { ##ERROR: syntax error - invalid class name 'super.a' for 'class'
var a
2024-10-03 08:21:08 +00:00
}
---
class a: 20 { ##ERROR: syntax error - invalid superclass name '20' after ':' for 'class'
2024-10-03 08:21:08 +00:00
}
---
class a: class { ##ERROR: syntax error - invalid superclass name 'class' after ':' for 'class'
2024-10-03 08:21:08 +00:00
}
---
class a: #(1 2) { ##ERROR: syntax error - no valid superclass name after ':' for 'class'
2024-10-03 08:21:08 +00:00
}
---
2024-07-22 06:06:45 +00:00
J := 11
class B {
if (== J 10) {
fun(#ci) newA() {
2024-07-22 06:06:45 +00:00
return self
}
} else {
fun(#ci) newB() {
2024-07-22 06:06:45 +00:00
return self
}
}
}
t2 := (B:newB)
t1 := (B:newA) ##ERROR: exception not handled - "unable to send newA to B - 'newA' not found in B"
---
class B {
var x
2024-07-22 06:06:45 +00:00
if (x > 0) { ##ERROR: syntax error - prohibited access to instance variable - x
}
}
---
class B {
var x y
};
class X: B {
var a b
fun(#ci) new(t) {
| a |
set self.a t;
set a 100;
set self.b (* t 2);
set self.c (fun(b) { ##ERROR: syntax error - unknown class-level variable name
printf "xxxx [%d]\n" b;
});
return self;
};
fun print() {
self.c (+ self.a self.b);
printf "a=%d b=%d\n" self.a self.b;
}
};
---
class X {
fun(#ci) xxx() {
return X;
}
fun(#ci) qqq() {
return "hello"
}
fun String:length() { ##ERROR: syntax error - class name 'String' before :'length' prohibited in class initialization context
return (core.basicSize self)
}
}
---
class X {
fun(#ci) xxx() {
return X;
}
fun(#ci) qqq() {
return "hello"
}
}
## this triggers a runtime error as J isn't a class name
fun J:ccc() { ##ERROR: exception not handled - "J accessed without initialization"
return 999
}
---
X := 20
## this also raises a runtime error as X isn't a class name
fun X:xxx() { ##ERROR: exception not handled - "not class"
return self
}
---
## this must not be very useful as Array is an index item
## and the clase instantiation method can't specify the size
## you can't place an item in the arrya at all.
fun(#ci) Array:boom() {
2024-08-10 05:42:21 +00:00
core.basicAtPut self 0 10 ##ERROR: exception not handled - "position(0) out of range - negative or greater than or equal to 0"
printf "%O" self
2024-08-01 15:34:42 +00:00
return self
}
Array:boom
---
class X {
var a b c
fun(#ci) new () {
self.a := 20
return self
}
fun getA() { return self.a }
}
## the instance variables are not accessible in out-of-class method
## defintionas there isn't a good way to know the class structure
## as X isn't known in advance and can point to anything
fun X:get_a() {
return self.a ##ERROR: syntax error - not allowed to prefix with self
}
printf "%d\n" ((X:new):get_a)
---
class F {
var a b c
}
class X {
var a b c
fun oh() {
fun F:get_a() {
return super.a ##ERROR: syntax error - not allowed to prefix with super
}
}
}
---
class F {
}
class F { ##ERROR: exception not handled - "prohibited redefintion of F
}
---
class F {
}
F := 30 ##ERROR: exception not handled - "prohibited redefintion of F
---
class F {
}
F := (class { ##ERROR: exception not handled - "prohibited redefintion of F"
})
---
F := (class {
})
F := (class F { ##ERROR: exception not handled - "prohibited redefintion of F"
})
## TDOO: do we need to allow this?
##F := 30
##class F { ##E R R O R: exception not handled - "prohibited redefintion of F"
##}
---
class a {
fun() { ##ERROR: syntax error - unnamed function defined with 'fun' prohibited in class initialziation context
}
}
---
class X10 {
var x
fun(#ci) make() { x := 1234; return self; };
fun get-x() { return x };
}
X11 := (class:X10 {
})
class X11 { ##ERROR: exception not handled - "prohibited redefintion of X11"
}
---
class String { ##ERROR: exception not handled - "incompatible redefintion of String"
}
---
class() { ##ERROR: syntax error - empty attribute list on unnamed class for 'class'
}
---
class() Kuduro { ##ERROR: syntax error - empty attribute list on 'Kuduro' for 'class'
}
---
class(#byte #limited #char) Kuduro { ##ERROR: syntax error - conflicting or duplicate class attribute name '#char'
}
---
class(#byte #limited #final #limited) Kuduro { ##ERROR: syntax error - conflicting or duplicate class attribute name '#limited'
}
---
class(#byte #bytes) Kuduro { ##ERROR: syntax error - unrecognized class attribute name '#bytes'
}
---
class Kuduro [a b c] {
var d e
var a ##ERROR: syntax error - duplicate instance variable name 'a'
}
---
class Kuduru [a [b] c] {
var d e
var b ##TODO: should this be prohibited?
}
class Kuduro [a [b] c] {
var d e
var(#class) b ##ERROR: syntax error - duplicate class variable name 'b'
}