Program: 9442
Project: 9442
Buggy source:
/** 
 * Need to determine if I'm really a pattern or a reference to a formal We may wish to further optimize the case of pattern vs. non-pattern We will be replaced by what we return
 */
public TypePattern resolveBindings(IScope scope,Bindings bindings,boolean allowBinding,boolean requireExactType){
  if (isStar()) {
    return TypePattern.ANY;
  }
  String simpleName=maybeGetSimpleName();
  if (simpleName != null) {
    FormalBinding formalBinding=scope.lookupFormal(simpleName);
    if (formalBinding != null) {
      if (bindings == null) {
        scope.message(IMessage.ERROR,this,"String_Node_Str");
        return this;
      }
      if (!allowBinding) {
        scope.message(IMessage.ERROR,this,"String_Node_Str");
        return this;
      }
      BindingTypePattern binding=new BindingTypePattern(formalBinding);
      binding.copyLocationFrom(this);
      bindings.register(binding,scope);
      return binding;
    }
  }
  String cleanName=maybeGetCleanName();
  String originalName=cleanName;
  if (cleanName != null) {
    TypeX type;
    while ((type=scope.lookupType(cleanName,this)) == ResolvedTypeX.MISSING) {
      int lastDot=cleanName.lastIndexOf('.');
      if (lastDot == -1)       break;
      cleanName=cleanName.substring(0,lastDot) + '$' + cleanName.substring(lastDot + 1);
    }
    if (type == ResolvedTypeX.MISSING) {
      if (requireExactType) {
        if (!allowBinding) {
          scope.getWorld().getMessageHandler().handleMessage(MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_BIND_TYPE,originalName),getSourceLocation()));
        }
 else         if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
          scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName,getSourceLocation());
        }
        return NO;
      }
 else       if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
        scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName,getSourceLocation());
      }
    }
 else {
      if (dim != 0)       type=TypeX.makeArray(type,dim);
      TypePattern ret=new ExactTypePattern(type,includeSubtypes);
      ret.copyLocationFrom(this);
      return ret;
    }
  }
 else {
    if (requireExactType) {
      scope.getWorld().getMessageHandler().handleMessage(MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED),getSourceLocation()));
      return NO;
    }
  }
  importedPrefixes=scope.getImportedPrefixes();
  knownMatches=preMatch(scope.getImportedNames());
  return this;
}

Fixed version (ground truth):
/** 
 * Need to determine if I'm really a pattern or a reference to a formal We may wish to further optimize the case of pattern vs. non-pattern We will be replaced by what we return
 */
public TypePattern resolveBindings(IScope scope,Bindings bindings,boolean allowBinding,boolean requireExactType){
  if (isStar()) {
    return TypePattern.ANY;
  }
  String simpleName=maybeGetSimpleName();
  if (simpleName != null) {
    FormalBinding formalBinding=scope.lookupFormal(simpleName);
    if (formalBinding != null) {
      if (bindings == null) {
        scope.message(IMessage.ERROR,this,"String_Node_Str");
        return this;
      }
      if (!allowBinding) {
        scope.message(IMessage.ERROR,this,"String_Node_Str");
        return this;
      }
      BindingTypePattern binding=new BindingTypePattern(formalBinding);
      binding.copyLocationFrom(this);
      bindings.register(binding,scope);
      return binding;
    }
  }
  String cleanName=maybeGetCleanName();
  String originalName=cleanName;
  ResolvedTypeX resolvedTypeInTheWorld=null;
  if (cleanName != null) {
    TypeX type;
    resolvedTypeInTheWorld=scope.getWorld().resolve(TypeX.forName(cleanName),true);
    while ((type=scope.lookupType(cleanName,this)) == ResolvedTypeX.MISSING) {
      int lastDot=cleanName.lastIndexOf('.');
      if (lastDot == -1)       break;
      cleanName=cleanName.substring(0,lastDot) + '$' + cleanName.substring(lastDot + 1);
      if (resolvedTypeInTheWorld == ResolvedTypeX.MISSING)       resolvedTypeInTheWorld=scope.getWorld().resolve(TypeX.forName(cleanName),true);
    }
    if (type == ResolvedTypeX.MISSING) {
      if (requireExactType) {
        if (!allowBinding) {
          scope.getWorld().getMessageHandler().handleMessage(MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_BIND_TYPE,originalName),getSourceLocation()));
        }
 else         if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
          scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName,getSourceLocation());
        }
        return NO;
      }
 else       if (scope.getWorld().getLint().invalidAbsoluteTypeName.isEnabled()) {
        if (resolvedTypeInTheWorld == ResolvedTypeX.MISSING)         scope.getWorld().getLint().invalidAbsoluteTypeName.signal(originalName,getSourceLocation());
      }
    }
 else {
      if (dim != 0)       type=TypeX.makeArray(type,dim);
      TypePattern ret=new ExactTypePattern(type,includeSubtypes);
      ret.copyLocationFrom(this);
      return ret;
    }
  }
 else {
    if (requireExactType) {
      scope.getWorld().getMessageHandler().handleMessage(MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED),getSourceLocation()));
      return NO;
    }
  }
  importedPrefixes=scope.getImportedPrefixes();
  knownMatches=preMatch(scope.getImportedNames());
  return this;
}