Rule out multiple super-new
This commit is contained in:
parent
0ef255916d
commit
f010a9ce71
|
@ -398,7 +398,11 @@
|
||||||
(tc-error/expr
|
(tc-error/expr
|
||||||
"typed classes must call super-new at the class top-level")
|
"typed classes must call super-new at the class top-level")
|
||||||
null]
|
null]
|
||||||
[else
|
[(> (length super-new-stx) 1)
|
||||||
|
(tc-error/expr
|
||||||
|
"typed classes must only call super-new a single time")
|
||||||
|
null]
|
||||||
|
[(= (length super-new-stx) 1)
|
||||||
(syntax-parse (car super-new-stx)
|
(syntax-parse (car super-new-stx)
|
||||||
#:literals (#%plain-app list cons quote)
|
#:literals (#%plain-app list cons quote)
|
||||||
[(#%plain-app super-go _ _ _ _ _
|
[(#%plain-app super-go _ _ _ _ _
|
||||||
|
|
|
@ -385,6 +385,12 @@
|
||||||
(super-new [x 3])))
|
(super-new [x 3])))
|
||||||
(new c% [x 5]))
|
(new c% [x 5]))
|
||||||
|
|
||||||
|
;; fails, super-new can only be called once per class
|
||||||
|
(check-err
|
||||||
|
(class: object%
|
||||||
|
(super-new)
|
||||||
|
(super-new)))
|
||||||
|
|
||||||
;; test different internal/external names
|
;; test different internal/external names
|
||||||
(check-ok
|
(check-ok
|
||||||
(define c% (class: object% (super-new)
|
(define c% (class: object% (super-new)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user