private void resolveUpperBoundsFromWhereClause(Set<JetType> upperBounds) {
    JetClassOrObject classOrObject =
        JetStubbedPsiUtil.getPsiOrStubParent(jetTypeParameter, JetClassOrObject.class, true);
    if (classOrObject instanceof JetClass) {
      JetClass jetClass = (JetClass) classOrObject;
      for (JetTypeConstraint jetTypeConstraint : jetClass.getTypeConstraints()) {
        DescriptorResolver.reportUnsupportedClassObjectConstraint(
            resolveSession.getTrace(), jetTypeConstraint);

        JetSimpleNameExpression constrainedParameterName =
            jetTypeConstraint.getSubjectTypeParameterName();
        if (constrainedParameterName != null) {
          if (getName().equals(constrainedParameterName.getReferencedNameAsName())) {
            resolveSession
                .getTrace()
                .record(BindingContext.REFERENCE_TARGET, constrainedParameterName, this);

            JetTypeReference boundTypeReference = jetTypeConstraint.getBoundTypeReference();
            if (boundTypeReference != null) {
              JetType boundType = resolveBoundType(boundTypeReference);
              if (!jetTypeConstraint.isClassObjectConstraint()) {
                upperBounds.add(boundType);
              }
            }
          }
        }
      }
    }
  }
 private JetType resolveBoundType(@NotNull JetTypeReference boundTypeReference) {
   return resolveSession
       .getTypeResolver()
       .resolveType(
           getContainingDeclaration().getScopeForClassHeaderResolution(),
           boundTypeReference,
           resolveSession.getTrace(),
           false);
 }
예제 #3
0
 @NotNull
 private List<AnnotationDescriptor> resolveAnnotations() {
   JetClassLikeInfo classInfo = declarationProvider.getOwnerInfo();
   JetModifierList modifierList = classInfo.getModifierList();
   if (modifierList != null) {
     AnnotationResolver annotationResolver = resolveSession.getInjector().getAnnotationResolver();
     JetScope scopeForDeclaration =
         getScopeProvider().getResolutionScopeForDeclaration(classInfo.getScopeAnchor());
     return annotationResolver.resolveAnnotationsWithArguments(
         scopeForDeclaration, modifierList, resolveSession.getTrace());
   } else {
     return Collections.emptyList();
   }
 }
예제 #4
0
 public LazyPackageMemberScope(
     @NotNull ResolveSession resolveSession,
     @NotNull PackageMemberDeclarationProvider declarationProvider,
     @NotNull PackageFragmentDescriptor thisPackage) {
   super(resolveSession, declarationProvider, thisPackage, resolveSession.getTrace());
 }