better error message for 'class foo', where foo is implemented in the instance.
authorClaus Gittinger <cg@exept.de>
Wed, 17 Oct 2001 17:31:02 +0200
changeset 1203 2bd6633eced0
parent 1202 95abdd4272cd
child 1204 225d759274bc
better error message for 'class foo', where foo is implemented in the instance.
Parser.st
--- a/Parser.st	Wed Oct 17 15:09:13 2001 +0200
+++ b/Parser.st	Wed Oct 17 17:31:02 2001 +0200
@@ -2901,7 +2901,19 @@
             selClass := classToCompileFor class.
             err := self checkSelector:sym inClass:selClass.
             err notNil ifTrue:[
-                err := err, ' in my metaclass'.
+                classToCompileFor isMeta ifTrue:[
+                    err := err, ' for the classes class'.
+                    (self checkSelector:sym inClass:classToCompileFor) isNil ifTrue:[
+                        err := err, '...\\...but its implemented for the class itself. You probably do not want the #class message here.'.
+                        err := err withCRs.
+                    ].
+                ] ifFalse:[
+                    err := err, ' for my class'.
+                    (self checkSelector:sym inClass:classToCompileFor) isNil ifTrue:[
+                        err := err, '...\\...but its implemented for instances. You may want to remove the #class message.'.
+                        err := err withCRs.
+                    ].
+                ].
             ].
         ] ifFalse:[(receiver type == #MethodVariable) ifTrue:[
             "if it is an uninitialized variable ..."
@@ -5990,6 +6002,6 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.306 2001-10-17 13:09:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.307 2001-10-17 15:31:02 cg Exp $'
 ! !
 Parser initialize!