Fix to null.m() bug
svn: r1433
This commit is contained in:
parent
ed870594bf
commit
8f1898eda7
|
@ -2007,6 +2007,8 @@
|
||||||
(cond
|
(cond
|
||||||
;List of methods found
|
;List of methods found
|
||||||
((list? call-exp) call-exp)
|
((list? call-exp) call-exp)
|
||||||
|
((eq? call-exp 'null)
|
||||||
|
(prim-call-error call-exp name src level))
|
||||||
((array-type? call-exp)
|
((array-type? call-exp)
|
||||||
(set! exp-type call-exp)
|
(set! exp-type call-exp)
|
||||||
(get-method-records name-string
|
(get-method-records name-string
|
||||||
|
@ -2769,11 +2771,13 @@
|
||||||
(t (type->ext-name exp)))
|
(t (type->ext-name exp)))
|
||||||
(raise-error
|
(raise-error
|
||||||
n
|
n
|
||||||
(format "attempted to call method ~a on ~a which does not have methods. ~nOnly values with ~a types have methods"
|
(if (eq? exp 'null)
|
||||||
|
(format "Attempted to call method ~a directly on null. The null value does not have any methods." n)
|
||||||
|
(format "Attempted to call method ~a on ~a which does not have methods. ~nOnly values with ~a types have methods"
|
||||||
n t
|
n t
|
||||||
(case level
|
(case level
|
||||||
((beginner intermediate) "class or interface")
|
((beginner intermediate) "class or interface")
|
||||||
(else "class, interface, or array")))
|
(else "class, interface, or array"))))
|
||||||
n src)))
|
n src)))
|
||||||
|
|
||||||
;no-method-error: symbol symbol type id src -> void
|
;no-method-error: symbol symbol type id src -> void
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
|
|
||||||
;make-error: 'a string 'a src -> void
|
;make-error: 'a string 'a src -> void
|
||||||
(define (make-error-pass parm)
|
(define (make-error-pass parm)
|
||||||
(lambda (kind message so src)
|
(lambda (_ message syn-obj src)
|
||||||
(raise-syntax-error 'Error #;kind message (make-so so src parm))))
|
(raise (make-exn:fail:syntax (string->immutable-string message)
|
||||||
|
(current-continuation-marks) (list-immutable (make-so syn-obj src parm))))))
|
||||||
|
|
||||||
|
|
||||||
;make-so: symbol src (-> location) -> syntax-object
|
;make-so: symbol src (-> location) -> syntax-object
|
||||||
(define (make-so id src parm)
|
(define (make-so id src parm)
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
|
|
||||||
;;Execution tests without errors
|
;;Execution tests without errors
|
||||||
|
|
||||||
|
(interact-test
|
||||||
|
'advanced
|
||||||
|
'("null.m()")
|
||||||
|
'(error)
|
||||||
|
"Calling a method on null")
|
||||||
|
|
||||||
(execute-test
|
(execute-test
|
||||||
"public class Something {
|
"public class Something {
|
||||||
private int x;
|
private int x;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user