001 /*
002 * Copyright 2010-2015 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.kotlin.types;
018
019 import kotlin.jvm.functions.Function1;
020 import org.jetbrains.annotations.NotNull;
021 import org.jetbrains.annotations.Nullable;
022 import org.jetbrains.kotlin.builtins.DefaultBuiltIns;
023 import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
024 import org.jetbrains.kotlin.descriptors.*;
025 import org.jetbrains.kotlin.descriptors.annotations.Annotations;
026 import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
027 import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl;
028 import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl;
029 import org.jetbrains.kotlin.descriptors.impl.TypeParameterDescriptorImpl;
030 import org.jetbrains.kotlin.incremental.components.LookupLocation;
031 import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
032 import org.jetbrains.kotlin.name.FqName;
033 import org.jetbrains.kotlin.name.Name;
034 import org.jetbrains.kotlin.platform.PlatformToKotlinClassMap;
035 import org.jetbrains.kotlin.resolve.ImportPath;
036 import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
037 import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter;
038 import org.jetbrains.kotlin.resolve.scopes.KtScope;
039 import org.jetbrains.kotlin.types.error.ErrorSimpleFunctionDescriptorImpl;
040 import org.jetbrains.kotlin.utils.Printer;
041
042 import java.util.Collection;
043 import java.util.Collections;
044 import java.util.List;
045 import java.util.Set;
046
047 import static kotlin.CollectionsKt.emptyList;
048 import static kotlin.CollectionsKt.joinToString;
049
050 public class ErrorUtils {
051
052 private static final ModuleDescriptor ERROR_MODULE;
053 static {
054 ERROR_MODULE = new ModuleDescriptor() {
055 @NotNull
056 @Override
057 public PlatformToKotlinClassMap getPlatformToKotlinClassMap() {
058 throw new IllegalStateException("Should not be called!");
059 }
060
061 @NotNull
062 @Override
063 public List<ImportPath> getDefaultImports() {
064 return emptyList();
065 }
066
067 @NotNull
068 @Override
069 public Annotations getAnnotations() {
070 return Annotations.Companion.getEMPTY();
071 }
072
073 @NotNull
074 @Override
075 public Collection<FqName> getSubPackagesOf(
076 @NotNull FqName fqName, @NotNull Function1<? super Name, ? extends Boolean> nameFilter
077 ) {
078 return emptyList();
079 }
080
081 @NotNull
082 @Override
083 public Name getName() {
084 return Name.special("<ERROR MODULE>");
085 }
086
087 @NotNull
088 @Override
089 public PackageViewDescriptor getPackage(@NotNull FqName fqName) {
090 throw new IllegalStateException("Should not be called!");
091 }
092
093 @Override
094 public <R, D> R accept(@NotNull DeclarationDescriptorVisitor<R, D> visitor, D data) {
095 return null;
096 }
097
098 @Override
099 public void acceptVoid(DeclarationDescriptorVisitor<Void, Void> visitor) {
100
101 }
102
103 @NotNull
104 @Override
105 public ModuleDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
106 return this;
107 }
108
109 @Override
110 public boolean isFriend(@NotNull ModuleDescriptor other) {
111 return false;
112 }
113
114 @NotNull
115 @Override
116 public DeclarationDescriptor getOriginal() {
117 return this;
118 }
119
120 @Nullable
121 @Override
122 public DeclarationDescriptor getContainingDeclaration() {
123 return null;
124 }
125
126 @NotNull
127 @Override
128 public KotlinBuiltIns getBuiltIns() {
129 return DefaultBuiltIns.getInstance();
130 }
131 };
132 }
133
134 public static boolean containsErrorType(@NotNull FunctionDescriptor function) {
135 if (containsErrorType(function.getReturnType())) {
136 return true;
137 }
138 ReceiverParameterDescriptor receiverParameter = function.getExtensionReceiverParameter();
139 if (receiverParameter != null && containsErrorType(receiverParameter.getType())) {
140 return true;
141 }
142 for (ValueParameterDescriptor parameter : function.getValueParameters()) {
143 if (containsErrorType(parameter.getType())) {
144 return true;
145 }
146 }
147 for (TypeParameterDescriptor parameter : function.getTypeParameters()) {
148 for (KotlinType upperBound : parameter.getUpperBounds()) {
149 if (containsErrorType(upperBound)) {
150 return true;
151 }
152 }
153 }
154
155 return false;
156 }
157
158 private static abstract class AbstractErrorScope implements KtScope {
159 @Nullable
160 @Override
161 public ClassifierDescriptor getClassifier(@NotNull Name name) {
162 return getClassifier(name, NoLookupLocation.UNSORTED);
163 }
164 }
165
166 public static class ErrorScope extends AbstractErrorScope {
167 private final String debugMessage;
168
169 private ErrorScope(@NotNull String debugMessage) {
170 this.debugMessage = debugMessage;
171 }
172
173 @Nullable
174 @Override
175 public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull LookupLocation location) {
176 return createErrorClass(name.asString());
177 }
178
179 @NotNull
180 @Override
181 public Set<VariableDescriptor> getProperties(@NotNull Name name, @NotNull LookupLocation location) {
182 return ERROR_VARIABLE_GROUP;
183 }
184
185 @NotNull
186 @Override
187 public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
188 @NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
189 @NotNull LookupLocation location
190 ) {
191 return ERROR_PROPERTY_GROUP;
192 }
193
194 @NotNull
195 @Override
196 public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
197 @NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
198 @NotNull LookupLocation location
199 ) {
200 return Collections.<FunctionDescriptor>singleton(createErrorFunction(this));
201 }
202
203 @NotNull
204 @Override
205 public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull Collection<? extends KotlinType> receiverTypes) {
206 return ERROR_PROPERTY_GROUP;
207 }
208
209 @NotNull
210 @Override
211 public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
212 @NotNull Collection<? extends KotlinType> receiverTypes
213 ) {
214 return Collections.<FunctionDescriptor>singleton(createErrorFunction(this));
215 }
216
217 @Override
218 public VariableDescriptor getLocalVariable(@NotNull Name name) {
219 return ERROR_PROPERTY;
220 }
221
222 @Override
223 public PackageViewDescriptor getPackage(@NotNull Name name) {
224 return null;
225 }
226
227 @NotNull
228 @Override
229 public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
230 return Collections.emptyList();
231 }
232
233 @NotNull
234 @Override
235 public Set<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull LookupLocation location) {
236 return Collections.<FunctionDescriptor>singleton(createErrorFunction(this));
237 }
238
239 @NotNull
240 @Override
241 public DeclarationDescriptor getContainingDeclaration() {
242 return ERROR_MODULE;
243 }
244
245 @NotNull
246 @Override
247 public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
248 return Collections.emptyList();
249 }
250
251 @NotNull
252 @Override
253 public Collection<DeclarationDescriptor> getDescriptors(
254 @NotNull DescriptorKindFilter kindFilter, @NotNull Function1<? super Name, ? extends Boolean> nameFilter
255 ) {
256 return Collections.emptyList();
257 }
258
259 @NotNull
260 @Override
261 public Collection<DeclarationDescriptor> getAllDescriptors() {
262 return Collections.emptyList();
263 }
264
265 @NotNull
266 @Override
267 public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
268 return Collections.emptyList();
269 }
270
271 @Override
272 public String toString() {
273 return "ErrorScope{" + debugMessage + '}';
274 }
275
276 @Override
277 public void printScopeStructure(@NotNull Printer p) {
278 p.println(getClass().getSimpleName(), ": ", debugMessage);
279 }
280 }
281
282 private static class ThrowingScope extends AbstractErrorScope {
283 private final String debugMessage;
284
285 private ThrowingScope(@NotNull String message) {
286 debugMessage = message;
287 }
288
289 @Nullable
290 @Override
291 public ClassifierDescriptor getClassifier(@NotNull Name name, @NotNull LookupLocation location) {
292 throw new IllegalStateException();
293 }
294
295 @Nullable
296 @Override
297 public PackageViewDescriptor getPackage(@NotNull Name name) {
298 throw new IllegalStateException();
299 }
300
301 @NotNull
302 @Override
303 public Collection<VariableDescriptor> getProperties(@NotNull Name name, @NotNull LookupLocation location) {
304 throw new IllegalStateException();
305 }
306
307 @Nullable
308 @Override
309 public VariableDescriptor getLocalVariable(@NotNull Name name) {
310 throw new IllegalStateException();
311 }
312
313 @NotNull
314 @Override
315 public Collection<FunctionDescriptor> getFunctions(@NotNull Name name, @NotNull LookupLocation location) {
316 throw new IllegalStateException();
317 }
318
319 @NotNull
320 @Override
321 public Collection<PropertyDescriptor> getSyntheticExtensionProperties(
322 @NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
323 @NotNull LookupLocation location
324 ) {
325 throw new IllegalStateException();
326 }
327
328 @NotNull
329 @Override
330 public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
331 @NotNull Collection<? extends KotlinType> receiverTypes, @NotNull Name name,
332 @NotNull LookupLocation location
333 ) {
334 throw new IllegalStateException();
335 }
336
337 @NotNull
338 @Override
339 public Collection<PropertyDescriptor> getSyntheticExtensionProperties(@NotNull Collection<? extends KotlinType> receiverTypes) {
340 throw new IllegalStateException();
341 }
342
343 @NotNull
344 @Override
345 public Collection<FunctionDescriptor> getSyntheticExtensionFunctions(
346 @NotNull Collection<? extends KotlinType> receiverTypes
347 ) {
348 throw new IllegalStateException();
349 }
350
351 @NotNull
352 @Override
353 public DeclarationDescriptor getContainingDeclaration() {
354 return ERROR_MODULE;
355 }
356
357 @NotNull
358 @Override
359 public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
360 throw new IllegalStateException();
361 }
362
363 @NotNull
364 @Override
365 public Collection<DeclarationDescriptor> getDescriptors(
366 @NotNull DescriptorKindFilter kindFilter, @NotNull Function1<? super Name, ? extends Boolean> nameFilter
367 ) {
368 throw new IllegalStateException();
369 }
370
371 @NotNull
372 @Override
373 public Collection<DeclarationDescriptor> getAllDescriptors() {
374 throw new IllegalStateException();
375 }
376
377 @NotNull
378 @Override
379 public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
380 throw new IllegalStateException();
381 }
382
383 @NotNull
384 @Override
385 public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
386 throw new IllegalStateException();
387 }
388
389 @Override
390 public String toString() {
391 return "ThrowingScope{" + debugMessage + '}';
392 }
393
394 @Override
395 public void printScopeStructure(@NotNull Printer p) {
396 p.println(getClass().getSimpleName(), ": ", debugMessage);
397 }
398 }
399
400 private static final ErrorClassDescriptor ERROR_CLASS = new ErrorClassDescriptor(null);
401
402 private static class ErrorClassDescriptor extends ClassDescriptorImpl {
403 public ErrorClassDescriptor(@Nullable String name) {
404 super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"),
405 Modality.OPEN, Collections.<KotlinType>emptyList(), SourceElement.NO_SOURCE);
406
407 ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.Companion.getEMPTY(), true, SourceElement.NO_SOURCE);
408 errorConstructor.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
409 Visibilities.INTERNAL);
410 KtScope memberScope = createErrorScope(getName().asString());
411 errorConstructor.setReturnType(
412 new ErrorTypeImpl(
413 createErrorTypeConstructorWithCustomDebugName("<ERROR>", this),
414 memberScope
415 )
416 );
417
418 initialize(memberScope, Collections.<ConstructorDescriptor>singleton(errorConstructor), errorConstructor);
419 }
420
421 @NotNull
422 @Override
423 public ClassDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
424 return this;
425 }
426
427 @Override
428 public String toString() {
429 return getName().asString();
430 }
431
432 @NotNull
433 @Override
434 public KtScope getMemberScope(@NotNull List<? extends TypeProjection> typeArguments) {
435 return createErrorScope("Error scope for class " + getName() + " with arguments: " + typeArguments);
436 }
437
438 @NotNull
439 @Override
440 public KtScope getMemberScope(@NotNull TypeSubstitution typeSubstitution) {
441 return createErrorScope("Error scope for class " + getName() + " with arguments: " + typeSubstitution);
442 }
443 }
444
445 @NotNull
446 public static ClassDescriptor createErrorClass(@NotNull String debugMessage) {
447 return new ErrorClassDescriptor(debugMessage);
448 }
449
450 @NotNull
451 public static KtScope createErrorScope(@NotNull String debugMessage) {
452 return createErrorScope(debugMessage, false);
453 }
454
455 @NotNull
456 public static KtScope createErrorScope(@NotNull String debugMessage, boolean throwExceptions) {
457 if (throwExceptions) {
458 return new ThrowingScope(debugMessage);
459 }
460 return new ErrorScope(debugMessage);
461 }
462
463 private static final KotlinType ERROR_PROPERTY_TYPE = createErrorType("<ERROR PROPERTY TYPE>");
464 private static final PropertyDescriptor ERROR_PROPERTY = createErrorProperty();
465
466 private static final Set<VariableDescriptor> ERROR_VARIABLE_GROUP = Collections.<VariableDescriptor>singleton(ERROR_PROPERTY);
467 private static final Set<PropertyDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
468
469 @NotNull
470 private static PropertyDescriptorImpl createErrorProperty() {
471 PropertyDescriptorImpl descriptor = PropertyDescriptorImpl.create(
472 ERROR_CLASS,
473 Annotations.Companion.getEMPTY(),
474 Modality.OPEN,
475 Visibilities.INTERNAL,
476 true,
477 Name.special("<ERROR PROPERTY>"),
478 CallableMemberDescriptor.Kind.DECLARATION,
479 SourceElement.NO_SOURCE,
480 /* lateInit = */ false,
481 /* isConst = */ false
482 );
483 descriptor.setType(ERROR_PROPERTY_TYPE,
484 Collections.<TypeParameterDescriptor>emptyList(),
485 null,
486 (KotlinType) null
487 );
488
489 return descriptor;
490 }
491
492 @NotNull
493 private static SimpleFunctionDescriptor createErrorFunction(@NotNull ErrorScope ownerScope) {
494 ErrorSimpleFunctionDescriptorImpl function = new ErrorSimpleFunctionDescriptorImpl(ERROR_CLASS, ownerScope);
495 function.initialize(
496 null,
497 null,
498 Collections.<TypeParameterDescriptorImpl>emptyList(), // TODO
499 Collections.<ValueParameterDescriptor>emptyList(), // TODO
500 createErrorType("<ERROR FUNCTION RETURN TYPE>"),
501 Modality.OPEN,
502 Visibilities.INTERNAL
503 );
504 return function;
505 }
506
507 @NotNull
508 public static KotlinType createErrorType(@NotNull String debugMessage) {
509 return createErrorTypeWithArguments(debugMessage, Collections.<TypeProjection>emptyList());
510 }
511
512 @NotNull
513 public static KotlinType createErrorTypeWithCustomDebugName(@NotNull String debugName) {
514 return createErrorTypeWithCustomConstructor(debugName, createErrorTypeConstructorWithCustomDebugName(debugName));
515 }
516
517 @NotNull
518 public static KotlinType createErrorTypeWithCustomConstructor(@NotNull String debugName, @NotNull TypeConstructor typeConstructor) {
519 return new ErrorTypeImpl(typeConstructor, createErrorScope(debugName));
520 }
521
522 @NotNull
523 public static KotlinType createErrorTypeWithArguments(@NotNull String debugMessage, @NotNull List<TypeProjection> arguments) {
524 return new ErrorTypeImpl(createErrorTypeConstructor(debugMessage), createErrorScope(debugMessage), arguments);
525 }
526
527 @NotNull
528 public static TypeConstructor createErrorTypeConstructor(@NotNull String debugMessage) {
529 return createErrorTypeConstructorWithCustomDebugName("[ERROR : " + debugMessage + "]", ERROR_CLASS);
530 }
531
532 @NotNull
533 public static TypeConstructor createErrorTypeConstructorWithCustomDebugName(@NotNull String debugName) {
534 return createErrorTypeConstructorWithCustomDebugName(debugName, ERROR_CLASS);
535 }
536
537 @NotNull
538 private static TypeConstructor createErrorTypeConstructorWithCustomDebugName(
539 @NotNull final String debugName, @NotNull final ErrorClassDescriptor errorClass
540 ) {
541 return new TypeConstructor() {
542 @NotNull
543 @Override
544 public List<TypeParameterDescriptor> getParameters() {
545 return emptyList();
546 }
547
548 @NotNull
549 @Override
550 public Collection<KotlinType> getSupertypes() {
551 return emptyList();
552 }
553
554 @Override
555 public boolean isFinal() {
556 return false;
557 }
558
559 @Override
560 public boolean isDenotable() {
561 return false;
562 }
563
564 @Nullable
565 @Override
566 public ClassifierDescriptor getDeclarationDescriptor() {
567 return errorClass;
568 }
569
570 @NotNull
571 @Override
572 public KotlinBuiltIns getBuiltIns() {
573 return DefaultBuiltIns.getInstance();
574 }
575
576 @NotNull
577 @Override
578 public Annotations getAnnotations() {
579 return Annotations.Companion.getEMPTY();
580 }
581
582 @Override
583 public String toString() {
584 return debugName;
585 }
586 };
587 }
588
589 public static boolean containsErrorType(@Nullable KotlinType type) {
590 if (type == null) return false;
591 if (type.isError()) return true;
592 for (TypeProjection projection : type.getArguments()) {
593 if (!projection.isStarProjection() && containsErrorType(projection.getType())) return true;
594 }
595 return false;
596 }
597
598 public static boolean isError(@NotNull DeclarationDescriptor candidate) {
599 return isErrorClass(candidate) || isErrorClass(candidate.getContainingDeclaration()) || candidate == ERROR_MODULE;
600 }
601
602 private static boolean isErrorClass(@Nullable DeclarationDescriptor candidate) {
603 return candidate instanceof ErrorClassDescriptor;
604 }
605
606 @NotNull
607 public static TypeParameterDescriptor createErrorTypeParameter(int index, @NotNull String debugMessage) {
608 return TypeParameterDescriptorImpl.createWithDefaultBound(
609 ERROR_CLASS,
610 Annotations.Companion.getEMPTY(),
611 false,
612 Variance.INVARIANT,
613 Name.special("<ERROR: " + debugMessage + ">"),
614 index
615 );
616 }
617
618 private static class ErrorTypeImpl implements KotlinType {
619 private final TypeConstructor constructor;
620 private final KtScope memberScope;
621 private final List<TypeProjection> arguments;
622
623 private ErrorTypeImpl(
624 @NotNull TypeConstructor constructor,
625 @NotNull KtScope memberScope,
626 @NotNull List<TypeProjection> arguments
627 ) {
628 this.constructor = constructor;
629 this.memberScope = memberScope;
630 this.arguments = arguments;
631 }
632
633 private ErrorTypeImpl(@NotNull TypeConstructor constructor, @NotNull KtScope memberScope) {
634 this(constructor, memberScope, Collections.<TypeProjection>emptyList());
635 }
636
637 @NotNull
638 @Override
639 public TypeConstructor getConstructor() {
640 return constructor;
641 }
642
643 @NotNull
644 @Override
645 public List<TypeProjection> getArguments() {
646 return arguments;
647 }
648
649 @NotNull
650 @Override
651 public TypeSubstitution getSubstitution() {
652 return new IndexedParametersSubstitution(constructor, arguments);
653 }
654
655 @Override
656 public boolean isMarkedNullable() {
657 return false;
658 }
659
660 @NotNull
661 @Override
662 public KtScope getMemberScope() {
663 return memberScope;
664 }
665
666 @Override
667 public boolean isError() {
668 return true;
669 }
670
671 @NotNull
672 @Override
673 public Annotations getAnnotations() {
674 return Annotations.Companion.getEMPTY();
675 }
676
677 @Nullable
678 @Override
679 public <T extends TypeCapability> T getCapability(@NotNull Class<T> capabilityClass) {
680 return null;
681 }
682
683 @NotNull
684 @Override
685 public TypeCapabilities getCapabilities() {
686 return TypeCapabilities.NONE.INSTANCE$;
687 }
688
689 @Override
690 public String toString() {
691 return constructor.toString() + (arguments.isEmpty() ? "" : joinToString(arguments, ", ", "<", ">", -1, "...", null));
692 }
693 }
694
695 @NotNull
696 public static ModuleDescriptor getErrorModule() {
697 return ERROR_MODULE;
698 }
699
700 public static boolean isUninferredParameter(@Nullable KotlinType type) {
701 return type != null && type.getConstructor() instanceof UninferredParameterTypeConstructor;
702 }
703
704 public static boolean containsUninferredParameter(@Nullable KotlinType type) {
705 return TypeUtils.containsSpecialType(type, new Function1<KotlinType, Boolean>() {
706 @Override
707 public Boolean invoke(KotlinType argumentType) {
708 return isUninferredParameter(argumentType);
709 }
710 });
711 }
712
713 @NotNull
714 public static KotlinType createUninferredParameterType(@NotNull TypeParameterDescriptor typeParameterDescriptor) {
715 return createErrorTypeWithCustomConstructor("Scope for error type for not inferred parameter: " + typeParameterDescriptor.getName(),
716 new UninferredParameterTypeConstructor(typeParameterDescriptor));
717 }
718
719 public static class UninferredParameterTypeConstructor implements TypeConstructor {
720 private final TypeParameterDescriptor typeParameterDescriptor;
721 private final TypeConstructor errorTypeConstructor;
722
723 private UninferredParameterTypeConstructor(@NotNull TypeParameterDescriptor descriptor) {
724 typeParameterDescriptor = descriptor;
725 errorTypeConstructor = createErrorTypeConstructorWithCustomDebugName("CANT_INFER_TYPE_PARAMETER: " + descriptor.getName());
726 }
727
728 @NotNull
729 public TypeParameterDescriptor getTypeParameterDescriptor() {
730 return typeParameterDescriptor;
731 }
732
733 @NotNull
734 @Override
735 public List<TypeParameterDescriptor> getParameters() {
736 return errorTypeConstructor.getParameters();
737 }
738
739 @NotNull
740 @Override
741 public Collection<KotlinType> getSupertypes() {
742 return errorTypeConstructor.getSupertypes();
743 }
744
745 @Override
746 public boolean isFinal() {
747 return errorTypeConstructor.isFinal();
748 }
749
750 @Override
751 public boolean isDenotable() {
752 return errorTypeConstructor.isDenotable();
753 }
754
755 @Nullable
756 @Override
757 public ClassifierDescriptor getDeclarationDescriptor() {
758 return errorTypeConstructor.getDeclarationDescriptor();
759 }
760
761 @NotNull
762 @Override
763 public Annotations getAnnotations() {
764 return errorTypeConstructor.getAnnotations();
765 }
766
767 @NotNull
768 @Override
769 public KotlinBuiltIns getBuiltIns() {
770 return DescriptorUtilsKt.getBuiltIns(typeParameterDescriptor);
771 }
772 }
773
774 private ErrorUtils() {}
775 }