public List < PDefinition > checkDuplicatePatterns ( PDefinition d , List < PDefinition > defs ) { Set < PDefinition > noDuplicates = new HashSet < PDefinition > ( ) ; for ( PDefinition d1 : defs ) { for ( PDefinition d2 : defs ) { if ( d1 != d2 && d1 . getName ( ) != null && d2 . getName ( ) != null && d1 . getName ( ) . equals ( d2 . getName ( ) ) ) { if ( ! af . getTypeComparator ( ) . compatible ( d1 . getType ( ) , d2 . getType ( ) ) ) { TypeCheckerErrors . report ( 3322 , "Duplicate patterns bind to different types" , d . getLocation ( ) , d ) ; TypeCheckerErrors . detail2 ( d1 . getName ( ) . getName ( ) , d1 . getType ( ) , d2 . getName ( ) . getName ( ) , d2 . getType ( ) ) ; } } } noDuplicates . add ( d1 ) ; } return new Vector < PDefinition > ( noDuplicates ) ; }
Check a DefinitionList for incompatible duplicate pattern definitions .