Improve error messages for superclass checks
Also add a test for the inherit-field case for this original commit: ed94d35105d43b087eab1814f939e86c593364f9
This commit is contained in:
parent
b7f41e65d7
commit
8b56ec986e
|
@ -444,14 +444,14 @@
|
|||
(check-same optional-external exp-optional-inits
|
||||
"optional init argument"))
|
||||
(check-exists super-method-names this%-override-names
|
||||
"override method")
|
||||
"overridable method")
|
||||
(check-exists super-augment-names this%-augment-names
|
||||
"augment method")
|
||||
"augmentable method")
|
||||
(check-exists (set-union super-method-names super-augment-names)
|
||||
this%-inherit-names
|
||||
"inherited method")
|
||||
"method")
|
||||
(check-exists super-field-names this%-inherit-field-names
|
||||
"inherited field")
|
||||
"field")
|
||||
(check-absent super-field-names this%-field-names "public field")
|
||||
(check-absent super-method-names this%-public-names "public method")
|
||||
(check-absent super-augment-names this%-pubment-names
|
||||
|
@ -1113,8 +1113,8 @@
|
|||
(for/or ([m (in-set required)])
|
||||
(and (not (set-member? actual m)) m)))
|
||||
(when missing
|
||||
(tc-error/expr (~a "class definition missing ~a ~a "
|
||||
"that is required by the expected type")
|
||||
(tc-error/expr (~a "superclass missing ~a ~a "
|
||||
"that the current class requires")
|
||||
msg missing)))
|
||||
|
||||
;; Set<Symbol> Set<Symbol> String -> Void
|
||||
|
|
|
@ -348,7 +348,7 @@
|
|||
(define/override (m y) (* 2 y)))))
|
||||
|
||||
;; fails, superclass missing public for override
|
||||
(check-err #:exn #rx"missing override method m"
|
||||
(check-err #:exn #rx"superclass missing overridable method m"
|
||||
(: d% (Class [m (Integer -> Integer)]))
|
||||
(define d% (class object% (super-new)
|
||||
(define/override (m y) (* 2 y)))))
|
||||
|
@ -578,6 +578,12 @@
|
|||
(inherit-field [y x])
|
||||
(set! y 1)))
|
||||
|
||||
;; fails, superclass missing inherited field
|
||||
(check-err #:exn #rx"superclass missing field"
|
||||
(class (class object% (super-new))
|
||||
(super-new)
|
||||
(inherit-field [y x])))
|
||||
|
||||
;; fails, missing super method for inherit
|
||||
(check-err
|
||||
(class (class object% (super-new)) (super-new) (inherit z)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user