private void maybeRecordAliasedNominalType(Node nameNode) {
Preconditions.checkArgument(nameNode.isQualifiedName());
Node aliasedDef = nameNode.getParent();
Preconditions.checkState(aliasedDef.isVar() || aliasedDef.isAssign());
JSDocInfo jsdoc = NodeUtil.getBestJSDocInfo(aliasedDef);
Node init = NodeUtil.getInitializer(nameNode);
RawNominalType rawType =
currentScope.getNominalType(QualifiedName.fromNode(init));
String initQname = init.getQualifiedName();
if (jsdoc.isConstructor()) {
if (rawType == null || rawType.isInterface()) {
warnings.add(JSError.make(init, EXPECTED_CONSTRUCTOR, initQname));
return;
}
} else if (jsdoc.isInterface()) {
if (rawType == null || !rawType.isInterface()) {
warnings.add(JSError.make(init, EXPECTED_INTERFACE, initQname));
return;
}
}