@@ -71,7 +71,6 @@ predicate correctRaise(string name, Expr exec) {
7171}
7272
7373predicate preferredRaise ( string name , string execName , string message ) {
74- // TODO: execName should be an IPA type
7574 attributeMethod ( name ) and
7675 execName = "AttributeError" and
7776 message = "should raise an AttributeError instead."
@@ -94,6 +93,7 @@ predicate preferredRaise(string name, string execName, string message) {
9493}
9594
9695predicate execIsOfType ( Expr exec , string execName ) {
96+ // Might make sense to have execName be an IPA type here. Or part of a more general API modelling builtin/stdlib subclass relations.
9797 exists ( string subclass |
9898 execName = "TypeError" and
9999 subclass = "TypeError"
@@ -149,6 +149,8 @@ predicate isNotImplementedError(Expr exec) {
149149 exec = API:: builtin ( "NotImplementedError" ) .getACall ( ) .asExpr ( )
150150}
151151
152+ string getExecName ( Expr exec ) { result = exec .( Call ) .getFunc ( ) .( Name ) .getId ( ) }
153+
152154from Function f , Expr exec , string message
153155where
154156 f .isSpecialMethod ( ) and
@@ -170,4 +172,4 @@ where
170172 else message = "This method raises $@ - " + subMessage
171173 )
172174 )
173- select f , message , exec , exec . toString ( ) // TODO: remove tostring
175+ select f , message , exec , getExecName ( exec )
0 commit comments