예제 #1
0
  private TypeProjection makeTypeProjection(KtScope scope, String typeStr) {
    WritableScopeImpl withX =
        new WritableScopeImpl(
            scope, scope.getContainingDeclaration(), RedeclarationHandler.DO_NOTHING, "With X");
    withX.addClassifierDescriptor(x);
    withX.addClassifierDescriptor(y);
    withX.changeLockLevel(WritableScope.LockLevel.READING);

    KtTypeProjection projection =
        KtPsiFactoryKt.KtPsiFactory(getProject())
            .createTypeArguments("<" + typeStr + ">")
            .getArguments()
            .get(0);

    KtTypeReference typeReference = projection.getTypeReference();
    assert typeReference != null;
    KotlinType type =
        typeResolver.resolveType(
            TypeTestUtilsKt.asLexicalScope(withX), typeReference, JetTestUtils.DUMMY_TRACE, true);

    return new TypeProjectionImpl(getProjectionKind(typeStr, projection), type);
  }
예제 #2
0
 private JetType makeType(JetScope scope, String typeStr) {
   return typeResolver.resolveType(
       scope, JetPsiFactory(getProject()).createType(typeStr), JetTestUtils.DUMMY_TRACE, true);
 }