(!pt.getType().isUnknown() ||
that.getMemberOperator() instanceof Tree.SpreadOp);
boolean nameNonempty = that.getIdentifier()!=null &&
!that.getIdentifier().getText().equals("");
if (nameNonempty && check) {
TypedDeclaration member;
String name = name(that.getIdentifier());
String container;
boolean ambiguous;
List<ProducedType> signature = that.getSignature();
boolean ellipsis = that.getEllipsis();
if (packageQualified) {
container = "package '" + unit.getPackage().getNameAsString() + "'";
Declaration pm = unit.getPackage()
.getMember(name, signature, ellipsis);
if (pm instanceof TypedDeclaration) {
member = (TypedDeclaration) pm;
}
else {
member = null;
}
ambiguous = false;
}
else {
pt = pt.resolveAliases(); //needed for aliases like "alias Id<T> => T"
TypeDeclaration d = getDeclaration(that, pt);
container = "type '" + d.getName(unit) + "'";
ClassOrInterface ci =
getContainingClassOrInterface(that.getScope());
if (ci!=null && d.inherits(ci) && !(d instanceof NothingType)) {
Declaration direct =
ci.getDirectMember(name, signature, ellipsis);
if (direct instanceof TypedDeclaration) {
member = (TypedDeclaration) direct;
}
else {
member = getTypedMember(d, name, signature, ellipsis, unit);
}
}
else {
member = getTypedMember(d, name, signature, ellipsis, unit);
}
ambiguous = member==null &&
d.isMemberAmbiguous(name, unit, signature, ellipsis);
}
if (member==null) {
if (error) {
if (ambiguous) {
that.addError("method or attribute is ambiguous: '" +
name + "' for " + container);
}
else {
that.addError("method or attribute does not exist: '" +
name + "' in " + container, 100);
unit.getUnresolvedReferences().add(that.getIdentifier());
}
}
}
else {
member = (TypedDeclaration) handleAbstraction(member, that);
that.setDeclaration(member);
boolean selfReference = isSelfReference(p);
if (!selfReference && !member.isShared()) {
member.setOtherInstanceAccess(true);
}
if (error) {
checkQualifiedVisibility(that, member, name, container,
selfReference);
checkSuperMember(that);