@@ -25,7 +25,7 @@ predicate ast_sanity(string clsname, string problem, string what) {
2525 clsname = a .getAQlClass ( ) |
2626 uniqueness_error ( count ( a .toString ( ) ) , "toString" , problem ) and what = "at " + a .getLocation ( ) .toString ( ) or
2727 uniqueness_error ( strictcount ( a .getLocation ( ) ) , "getLocation" , problem ) and what = a .getLocation ( ) .toString ( ) or
28- not exists ( a .getLocation ( ) ) and problem = "no location" and what = a .toString ( )
28+ not exists ( a .getLocation ( ) ) and not a . ( Module ) . isPackage ( ) and problem = "no location" and what = a .toString ( )
2929 )
3030}
3131
@@ -54,8 +54,11 @@ predicate location_sanity(string clsname, string problem, string what) {
5454predicate cfg_sanity ( string clsname , string problem , string what ) {
5555 exists ( ControlFlowNode f |
5656 clsname = f .getAQlClass ( ) |
57- uniqueness_error ( count ( f .getNode ( ) ) , "getNode" , problem ) and what = "at " + f .getLocation ( ) .toString ( ) or
58- not exists ( f .getLocation ( ) ) and problem = "no location" and what = f .toString ( ) or
57+ uniqueness_error ( count ( f .getNode ( ) ) , "getNode" , problem ) and what = "at " + f .getLocation ( ) .toString ( )
58+ or
59+ not exists ( f .getLocation ( ) ) and not exists ( Module p | p .isPackage ( ) | p .getEntryNode ( ) = f or p .getAnExitNode ( ) = f )
60+ and problem = "no location" and what = f .toString ( )
61+ or
5962 uniqueness_error ( count ( f .( AttrNode ) .getObject ( ) ) , "getValue" , problem ) and what = "at " + f .getLocation ( ) .toString ( )
6063 )
6164}
@@ -66,7 +69,7 @@ predicate scope_sanity(string clsname, string problem, string what) {
6669 uniqueness_error ( count ( s .getEntryNode ( ) ) , "getEntryNode" , problem ) and what = "at " + s .getLocation ( ) .toString ( ) or
6770 uniqueness_error ( count ( s .toString ( ) ) , "toString" , problem ) and what = "at " + s .getLocation ( ) .toString ( ) or
6871 uniqueness_error ( strictcount ( s .getLocation ( ) ) , "getLocation" , problem ) and what = "at " + s .getLocation ( ) .toString ( ) or
69- not exists ( s .getLocation ( ) ) and problem = "no location" and what = s .toString ( )
72+ not exists ( s .getLocation ( ) ) and problem = "no location" and what = s .toString ( ) and not s . ( Module ) . isPackage ( )
7073 )
7174}
7275
@@ -213,11 +216,14 @@ predicate file_sanity(string clsname, string problem, string what) {
213216}
214217
215218predicate class_value_sanity ( string clsname , string problem , string what ) {
216- exists ( ClassValue value |
217- exists ( value .getASuperType ( ) .lookup ( what ) ) and
218- not exists ( value .lookup ( what ) ) and
219+ exists ( ClassValue value , ClassValue sup , string attr |
220+ what = value .getName ( ) and
221+ sup = value .getASuperType ( ) and
222+ exists ( sup .lookup ( attr ) ) and
223+ not value .failedInference ( _) and
224+ not exists ( value .lookup ( attr ) ) and
219225 clsname = value .getAQlClass ( ) and
220- problem = "is missing attribute that superclass has "
226+ problem = "no attribute '" + attr + "', but super type '" + sup . getName ( ) + "' does. "
221227 )
222228}
223229
0 commit comments