Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
54,400
boolean (TargetBackend targetBackend, List<String> backends) { if (targetBackend == TargetBackend.ANY) return false; return backends.isEmpty() || backends.contains(targetBackend.name()) || isCompatibleTargetExceptAny(targetBackend.getCompatibleWith(), backends); }
isCompatibleTargetExceptAny
54,401
boolean (TargetBackend targetBackend, File file, String ignoreBackendDirectivePrefix) { List<String> ignoredBackends = findListWithPrefixes(textWithDirectives(file), ignoreBackendDirectivePrefix); return ignoredBackends.contains(targetBackend.name()); }
isIgnoredTarget
54,402
boolean (TargetBackend targetBackend, File file) { return isIgnoredTarget(targetBackend, file, IGNORE_BACKEND_DIRECTIVE_PREFIX); }
isIgnoredTarget
54,403
void (String fileText) { List<String> muted = findListWithPrefixes(fileText, MUTED_DIRECTIVE_PREFIX); if (muted.isEmpty()) return; throw new RuntimeException("muted:" + muted); }
checkIfMuted
54,404
boolean (boolean compileWithK2, @NotNull File file) { return compileWithK2 && isDirectiveDefined(textWithDirectives(file), IGNORE_FOR_K2_CODE); }
isIgnoredForK2Code
54,405
String (List<LineMarkerInfo> lineMarkers, boolean withDescription, String text) { List<LineMarkerTagPoint> lineMarkerPoints = toLineMarkerTagPoints(lineMarkers, withDescription); return insertTagsInText(lineMarkerPoints, text, (TagInfo t) -> null); }
insertInfoTags
54,406
String (List<HighlightInfo> highlights, String text) { List<HighlightTagPoint> highlightPoints = toHighlightTagPoints(highlights); return insertTagsInText(highlightPoints, text, (TagInfo t) -> null); }
insertInfoTags
54,407
String (@NotNull Editor editor) { List<TagInfo> points = new ArrayList<>(); points.add(new TagInfo<>(editor.getCaretModel().getOffset(), true, "caret")); if (editor.getSelectionModel().hasSelection()) { points.add(new TagInfo<>(editor.getSelectionModel().getSelectionStart(), true, "selection")); points.add(new TagInfo<...
generateTextWithCaretAndSelection
54,408
String (List<? extends TagInfo> tags, String text, Function<TagInfo, String> computeExtraAttributes) { StringBuilder builder = new StringBuilder(text); // Need to sort tags for inserting them in reverse order to have valid offsets for yet not inserted tags. // Can't just sort in reverse order but do sort plus reverse i...
insertTagsInText
54,409
List<LineMarkerTagPoint> ( Collection<LineMarkerInfo> lineMarkers, boolean withDescription ) { List<LineMarkerTagPoint> lineMarkerPoints = new ArrayList<>(); for (LineMarkerInfo markerInfo : lineMarkers) { lineMarkerPoints.add(new LineMarkerTagPoint(markerInfo.startOffset, true, markerInfo, withDescription)); lineMarke...
toLineMarkerTagPoints
54,410
List<HighlightTagPoint> (Collection<HighlightInfo> highlights) { List<HighlightTagPoint> highlightPoints = new ArrayList<>(); for (HighlightInfo highlight : highlights) { highlightPoints.add(new HighlightTagPoint(highlight.startOffset, true, highlight)); highlightPoints.add(new HighlightTagPoint(highlight.endOffset, fa...
toHighlightTagPoints
54,411
int (@NotNull TagInfo<?> other) { if (offset != other.offset) { return Integer.compare(offset, other.offset); } if (isStart != other.isStart) { // All "starts" should go after "ends" for same offset return isStart ? -1 : 1; } if (isFixed || other.isFixed) { return 0; } String thisTag = this.getName() + this.getAttribut...
compareTo
54,412
String () { return data.toString(); }
getName
54,413
String () { return ""; }
getAttributesString
54,414
String () { return highlightInfo.getSeverity().equals(HighlightSeverity.INFORMATION) ? "info" : highlightInfo.getSeverity().toString().toLowerCase(Locale.ROOT); }
getName
54,415
String () { if (isStart) { if (highlightInfo.getDescription() != null) { return String.format("descr=\"%s\" textAttributesKey=\"%s\"", sanitizeLineBreaks(highlightInfo.getDescription()), highlightInfo.forcedTextAttributesKey ); } else { return String.format("textAttributesKey=\"%s\"", highlightInfo.forcedTextAttributes...
getAttributesString
54,416
String () { return "lineMarker"; }
getName
54,417
String () { return withDescription ? String.format("descr=\"%s\"", sanitizeLineMarkerTooltip(data.getLineMarkerTooltip())) : "descr=\"*\""; }
getAttributesString
54,418
String (@Nullable String originalText) { if (originalText == null) return "null"; String noHtmlTags = StringUtil.removeHtmlTags(originalText); return sanitizeLineBreaks(noHtmlTags); }
sanitizeLineMarkerTooltip
54,419
String (String originalText) { return StringUtil.replace(originalText, "\n", " "); }
sanitizeLineBreaks
54,420
String (String string, int start, int end) { Matcher matcher = LINE_SEPARATOR_PATTERN.matcher(string); StringBuilder prefix = new StringBuilder(); int lastLineOffset = 0; while (matcher.find()) { if (matcher.end() > start) { break; } lastLineOffset = matcher.end(); prefix.append('\n'); } while (lastLineOffset++ < start...
substringKeepingLocations
54,421
List<String> (@Nullable String dependencies) { if (dependencies == null) return Collections.emptyList(); return kotlin.text.StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0); }
parseModuleList
54,422
F ( @Nullable KotlinBaseTest.TestModule module, @NotNull String fileName, @NotNull String text, @NotNull Directives directives ) { return create(fileName, text, directives); }
createFile
54,423
String (@NotNull DeclarationDescriptor declarationDescriptor) { StringBuilder result = new StringBuilder(); appendDeclarationRecursively(declarationDescriptor, DescriptorUtils.getContainingModule(declarationDescriptor), new Printer(result, 1), true); return result.toString(); }
serializeRecursively
54,424
void ( @NotNull DeclarationDescriptor descriptor, @NotNull ModuleDescriptor module, @NotNull Printer printer, boolean topLevel ) { if (!isFromModule(descriptor, module)) return; boolean isEnumEntry = isEnumEntry(descriptor); boolean isClassOrPackage = (descriptor instanceof ClassOrPackageFragmentDescriptor || descripto...
appendDeclarationRecursively
54,425
void ( @NotNull DeclarationDescriptor descriptor, @NotNull Printer printer ) { boolean isPrimaryConstructor = conf.checkPrimaryConstructors && descriptor instanceof ConstructorDescriptor && ((ConstructorDescriptor) descriptor).isPrimary(); boolean isRecord = descriptor instanceof JavaClassDescriptor && ((JavaClassDescr...
printDescriptor
54,426
void (FunctionDescriptor functionDescriptor, Printer printer) { AbstractContractProvider contractProvider = functionDescriptor.getUserData(ContractProviderKey.INSTANCE); if (contractProvider == null) return; ContractDescription contractDescription = contractProvider.getContractDescription(); if (contractDescription == ...
printEffectsIfAny
54,427
MemberScope (@NotNull PackageViewDescriptor descriptor, @NotNull ModuleDescriptor module) { // See LazyPackageViewDescriptorImpl#memberScope List<MemberScope> scopes = new ArrayList<>(); for (PackageFragmentDescriptor fragment : descriptor.getFragments()) { if (isFromModule(fragment, module)) { scopes.add(fragment.getM...
getPackageScopeInModule
54,428
boolean (@NotNull DeclarationDescriptor descriptor, @NotNull ModuleDescriptor module) { if (conf.renderDeclarationsFromOtherModules) return true; if (descriptor instanceof PackageViewDescriptor) { // PackageViewDescriptor does not belong to any module, so we check if one of its containing fragments is in our module for...
isFromModule
54,429
boolean (@NotNull DeclarationDescriptor subDescriptor) { boolean isFunctionFromAny = subDescriptor.getContainingDeclaration() instanceof ClassDescriptor && subDescriptor instanceof FunctionDescriptor && KOTLIN_ANY_METHOD_NAMES.contains(subDescriptor.getName().asString()); return (isFunctionFromAny && !conf.includeMetho...
shouldSkip
54,430
void ( @NotNull DeclarationDescriptor descriptor, @NotNull ModuleDescriptor module, @NotNull MemberScope memberScope, @NotNull Collection<? extends DeclarationDescriptor> extraSubDescriptors, @NotNull Printer printer ) { if (!isFromModule(descriptor, module)) return; List<DeclarationDescriptor> subDescriptors = Lists.n...
appendSubDescriptors
54,431
void ( @NotNull DeclarationDescriptor actual, @NotNull Configuration configuration, @NotNull File txtFile ) { doCompareDescriptors(null, actual, configuration, txtFile); }
compareDescriptorWithFile
54,432
void ( @NotNull DeclarationDescriptor expected, @NotNull DeclarationDescriptor actual, @NotNull Configuration configuration, @Nullable File txtFile ) { if (expected == actual) { throw new IllegalArgumentException("Don't invoke this method with expected == actual." + "Invoke compareDescriptorWithFile() instead."); } doC...
compareDescriptors
54,433
void ( @NotNull DeclarationDescriptor actual, @NotNull Configuration configuration, @NotNull File txtFile ) { DescriptorValidator.validate(configuration.validationStrategy, actual); compareDescriptorWithFile(actual, configuration, txtFile); }
validateAndCompareDescriptorWithFile
54,434
void ( @NotNull DeclarationDescriptor expected, @NotNull DeclarationDescriptor actual, @NotNull Configuration configuration, @Nullable File txtFile ) { DescriptorValidator.validate(configuration.validationStrategy, expected); DescriptorValidator.validate(configuration.validationStrategy, actual); compareDescriptors(exp...
validateAndCompareDescriptors
54,435
void ( @Nullable DeclarationDescriptor expected, @NotNull DeclarationDescriptor actual, @NotNull Configuration configuration, @Nullable File txtFile ) { RecursiveDescriptorComparator comparator = new RecursiveDescriptorComparator(configuration); String actualSerialized = comparator.serializeRecursively(actual); if (exp...
doCompareDescriptors
54,436
Configuration (@NotNull Predicate<DeclarationDescriptor> stepIntoFilter) { return new Configuration(checkPrimaryConstructors, checkPropertyAccessors, includeMethodsOfKotlinAny, renderDeclarationsFromOtherModules, checkFunctionContracts, stepIntoFilter, validationStrategy.withStepIntoFilter(stepIntoFilter), renderer); }
filterRecursion
54,437
Configuration (boolean checkPrimaryConstructors) { return new Configuration(checkPrimaryConstructors, checkPropertyAccessors, includeMethodsOfKotlinAny, renderDeclarationsFromOtherModules, checkFunctionContracts, recursiveFilter, validationStrategy, renderer); }
checkPrimaryConstructors
54,438
Configuration (boolean checkPropertyAccessors) { return new Configuration( checkPrimaryConstructors, checkPropertyAccessors, includeMethodsOfKotlinAny, renderDeclarationsFromOtherModules, checkFunctionContracts, recursiveFilter, validationStrategy, rendererWithPropertyAccessors(renderer, checkPropertyAccessors) ); }
checkPropertyAccessors
54,439
Configuration (@NotNull DescriptorValidator.ValidationVisitor validationStrategy) { return new Configuration(checkPrimaryConstructors, checkPropertyAccessors, includeMethodsOfKotlinAny, renderDeclarationsFromOtherModules, checkFunctionContracts, recursiveFilter, validationStrategy, renderer); }
withValidationStrategy
54,440
Configuration (@NotNull Consumer<DescriptorRendererOptions> configure) { return new Configuration( checkPrimaryConstructors, checkPropertyAccessors, includeMethodsOfKotlinAny, renderDeclarationsFromOtherModules, checkFunctionContracts, recursiveFilter, validationStrategy, newRenderer(renderer, configure)); }
withRendererOptions
54,441
DescriptorRenderer ( @NotNull DescriptorRenderer renderer, boolean checkPropertyAccessors ) { return newRenderer(renderer, options -> options.setPropertyAccessorRenderingPolicy( checkPropertyAccessors ? PropertyAccessorRenderingPolicy.DEBUG : PropertyAccessorRenderingPolicy.NONE ) ); }
rendererWithPropertyAccessors
54,442
DescriptorRenderer ( @NotNull DescriptorRenderer renderer, @NotNull Consumer<DescriptorRendererOptions> configure ) { return renderer.withOptions(options -> { configure.accept(options); return Unit.INSTANCE; }); }
newRenderer
54,443
void (@NotNull ValidationVisitor validationStrategy, DeclarationDescriptor descriptor) { DiagnosticCollectorForTests collector = new DiagnosticCollectorForTests(); validate(validationStrategy, descriptor, collector); collector.done(); }
validate
54,444
void ( @NotNull ValidationVisitor validator, @NotNull DeclarationDescriptor descriptor, @NotNull DiagnosticCollector collector ) { RecursiveDescriptorProcessor.process(descriptor, collector, validator); }
validate
54,445
void (@NotNull DiagnosticCollector collector, @NotNull DeclarationDescriptor descriptor, @NotNull String message) { collector.report(new ValidationDiagnostic(descriptor, message)); }
report
54,446
ValidationVisitor () { return new ValidationVisitor(); }
errorTypesForbidden
54,447
ValidationVisitor (@NotNull Predicate<DeclarationDescriptor> filter) { this.recursiveFilter = filter; return this; }
withStepIntoFilter
54,448
void (DeclarationDescriptor scopeOwner, @NotNull MemberScope scope, @NotNull DiagnosticCollector collector) { for (DeclarationDescriptor descriptor : DescriptorUtils.getAllDescriptors(scope)) { if (recursiveFilter.test(descriptor)) { descriptor.accept(new ScopeValidatorVisitor(collector), scope); } } }
validateScope
54,449
void ( @NotNull DeclarationDescriptor descriptor, @Nullable KotlinType type, @NotNull DiagnosticCollector collector ) { if (type == null) { report(collector, descriptor, "No type"); return; } if (!allowErrorTypes && KotlinTypeKt.isError(type)) { report(collector, descriptor, "Error type: " + type); return; } validateSc...
validateType
54,450
void (CallableDescriptor descriptor, DiagnosticCollector collector) { validateType(descriptor, descriptor.getReturnType(), collector); }
validateReturnType
54,451
void (DiagnosticCollector collector, List<TypeParameterDescriptor> parameters) { for (int i = 0; i < parameters.size(); i++) { TypeParameterDescriptor typeParameterDescriptor = parameters.get(i); if (typeParameterDescriptor.getIndex() != i) { report(collector, typeParameterDescriptor, "Incorrect index: " + typeParamete...
validateTypeParameters
54,452
void (DiagnosticCollector collector, List<ValueParameterDescriptor> parameters) { for (int i = 0; i < parameters.size(); i++) { ValueParameterDescriptor valueParameterDescriptor = parameters.get(i); if (valueParameterDescriptor.getIndex() != i) { report(collector, valueParameterDescriptor, "Incorrect index: " + valuePa...
validateValueParameters
54,453
void ( DeclarationDescriptor descriptor, DiagnosticCollector collector, Collection<KotlinType> types ) { for (KotlinType type : types) { validateType(descriptor, type, collector); } }
validateTypes
54,454
void (CallableDescriptor descriptor, DiagnosticCollector collector) { validateReturnType(descriptor, collector); validateTypeParameters(collector, descriptor.getTypeParameters()); validateValueParameters(collector, descriptor.getValueParameters()); }
validateCallable
54,455
void ( PropertyDescriptor descriptor, DiagnosticCollector collector, PropertyAccessorDescriptor accessor ) { // TODO: fix the discrepancies in descriptor construction and enable these checks //assertEquals(accessor, collector, name + " visibility", descriptor.getVisibility(), accessor.getVisibility()); //assertEquals(a...
validateAccessor
54,456
Boolean ( PackageFragmentDescriptor descriptor, DiagnosticCollector collector ) { validateScope(descriptor, descriptor.getMemberScope(), collector); return true; }
visitPackageFragmentDescriptor
54,457
Boolean (PackageViewDescriptor descriptor, DiagnosticCollector collector) { if (!recursiveFilter.test(descriptor)) return false; validateScope(descriptor, descriptor.getMemberScope(), collector); return true; }
visitPackageViewDescriptor
54,458
Boolean ( VariableDescriptor descriptor, DiagnosticCollector collector ) { validateReturnType(descriptor, collector); return true; }
visitVariableDescriptor
54,459
Boolean ( FunctionDescriptor descriptor, DiagnosticCollector collector ) { validateCallable(descriptor, collector); return true; }
visitFunctionDescriptor
54,460
Boolean ( TypeParameterDescriptor descriptor, DiagnosticCollector collector ) { validateTypes(descriptor, collector, descriptor.getUpperBounds()); validateType(descriptor, descriptor.getDefaultType(), collector); return true; }
visitTypeParameterDescriptor
54,461
Boolean ( ClassDescriptor descriptor, DiagnosticCollector collector ) { validateTypeParameters(collector, descriptor.getDeclaredTypeParameters()); Collection<KotlinType> supertypes = descriptor.getTypeConstructor().getSupertypes(); if (supertypes.isEmpty() && descriptor.getKind() != ClassKind.INTERFACE && !KotlinBuiltI...
visitClassDescriptor
54,462
Boolean ( TypeAliasDescriptor descriptor, DiagnosticCollector data ) { // TODO typealias return true; }
visitTypeAliasDescriptor
54,463
Boolean ( ModuleDescriptor descriptor, DiagnosticCollector collector ) { return true; }
visitModuleDeclaration
54,464
Boolean ( ConstructorDescriptor constructorDescriptor, DiagnosticCollector collector ) { visitFunctionDescriptor(constructorDescriptor, collector); assertEqualTypes(constructorDescriptor, collector, "return type", constructorDescriptor.getContainingDeclaration().getDefaultType(), constructorDescriptor.getReturnType());...
visitConstructorDescriptor
54,465
Boolean ( ScriptDescriptor scriptDescriptor, DiagnosticCollector collector ) { return true; }
visitScriptDescriptor
54,466
Boolean ( PropertyDescriptor descriptor, DiagnosticCollector collector ) { validateCallable(descriptor, collector); PropertyGetterDescriptor getter = descriptor.getGetter(); if (getter != null) { assertEqualTypes(getter, collector, "getter return type", descriptor.getType(), getter.getReturnType()); validateAccessor(de...
visitPropertyDescriptor
54,467
Boolean ( ValueParameterDescriptor descriptor, DiagnosticCollector collector ) { return visitVariableDescriptor(descriptor, collector); }
visitValueParameterDescriptor
54,468
Boolean ( PropertyGetterDescriptor descriptor, DiagnosticCollector collector ) { return visitFunctionDescriptor(descriptor, collector); }
visitPropertyGetterDescriptor
54,469
Boolean ( PropertySetterDescriptor descriptor, DiagnosticCollector collector ) { return visitFunctionDescriptor(descriptor, collector); }
visitPropertySetterDescriptor
54,470
Boolean ( ReceiverParameterDescriptor descriptor, DiagnosticCollector collector ) { validateType(descriptor, descriptor.getType(), collector); return true; }
visitReceiverParameterDescriptor
54,471
void (DeclarationDescriptor expected, String message) { DescriptorValidator.report(collector, expected, message); }
report
54,472
void ( @NotNull MemberScope scope, @NotNull DeclarationDescriptor expected, @Nullable DeclarationDescriptor found ) { if (found == null) { report(expected, "Not found in " + scope); } if (true ? expected != found : !expected.equals(found)) { report(expected, "Lookup error in " + scope + ": " + found); } }
assertFound
54,473
void ( @NotNull MemberScope scope, @NotNull DeclarationDescriptor expected, @NotNull Collection<? extends DeclarationDescriptor> found ) { if (!found.contains(expected)) { report(expected, "Not found in " + scope + ": " + found); } }
assertFound
54,474
Void ( PackageFragmentDescriptor descriptor, MemberScope scope ) { return null; }
visitPackageFragmentDescriptor
54,475
Void ( PackageViewDescriptor descriptor, MemberScope scope ) { return null; }
visitPackageViewDescriptor
54,476
Void ( VariableDescriptor descriptor, MemberScope scope ) { assertFound(scope, descriptor, scope.getContributedVariables(descriptor.getName(), NoLookupLocation.FROM_TEST)); return null; }
visitVariableDescriptor
54,477
Void ( FunctionDescriptor descriptor, MemberScope scope ) { assertFound(scope, descriptor, scope.getContributedFunctions(descriptor.getName(), NoLookupLocation.FROM_TEST)); return null; }
visitFunctionDescriptor
54,478
Void ( TypeParameterDescriptor descriptor, MemberScope scope ) { assertFound(scope, descriptor, scope.getContributedClassifier(descriptor.getName(), NoLookupLocation.FROM_TEST)); return null; }
visitTypeParameterDescriptor
54,479
Void ( ClassDescriptor descriptor, MemberScope scope ) { assertFound(scope, descriptor, scope.getContributedClassifier(descriptor.getName(), NoLookupLocation.FROM_TEST)); return null; }
visitClassDescriptor
54,480
Void (TypeAliasDescriptor descriptor, MemberScope data) { // TODO typealias return null; }
visitTypeAliasDescriptor
54,481
Void ( ModuleDescriptor descriptor, MemberScope scope ) { report(descriptor, "Module found in scope: " + scope); return null; }
visitModuleDeclaration
54,482
Void ( ConstructorDescriptor descriptor, MemberScope scope ) { report(descriptor, "Constructor found in scope: " + scope); return null; }
visitConstructorDescriptor
54,483
Void ( ScriptDescriptor descriptor, MemberScope scope ) { report(descriptor, "Script found in scope: " + scope); return null; }
visitScriptDescriptor
54,484
Void ( PropertyDescriptor descriptor, MemberScope scope ) { return visitVariableDescriptor(descriptor, scope); }
visitPropertyDescriptor
54,485
Void ( ValueParameterDescriptor descriptor, MemberScope scope ) { return visitVariableDescriptor(descriptor, scope); }
visitValueParameterDescriptor
54,486
Void ( PropertyGetterDescriptor descriptor, MemberScope scope ) { report(descriptor, "Getter found in scope: " + scope); return null; }
visitPropertyGetterDescriptor
54,487
Void ( PropertySetterDescriptor descriptor, MemberScope scope ) { report(descriptor, "Setter found in scope: " + scope); return null; }
visitPropertySetterDescriptor
54,488
Void ( ReceiverParameterDescriptor descriptor, MemberScope scope ) { report(descriptor, "Receiver parameter found in scope: " + scope); return null; }
visitReceiverParameterDescriptor
54,489
DeclarationDescriptor () { return descriptor; }
getDescriptor
54,490
String () { return message; }
getMessage
54,491
void (@NotNull PrintStream out) { out.println(descriptor); out.println(message); stackTrace.printStackTrace(out); }
printStackTrace
54,492
String () { return descriptor + " > " + message; }
toString
54,493
void (@NotNull ValidationDiagnostic diagnostic) { diagnostic.printStackTrace(System.err); errorsFound = true; }
report
54,494
void () { if (errorsFound) { Assert.fail("Descriptor validation failed (see messages above)"); } }
done
54,495
boolean (Collection<? extends DeclarationDescriptor> descriptors, D data) { for (DeclarationDescriptor descriptor : descriptors) { if (!descriptor.accept(this, data)) return false; } return true; }
visitChildren
54,496
boolean (@Nullable DeclarationDescriptor descriptor, D data) { if (descriptor == null) return true; return descriptor.accept(this, data); }
visitChildren
54,497
boolean (@NotNull DeclarationDescriptor descriptor, D data) { return descriptor.accept(worker, data); }
applyWorker
54,498
boolean (CallableDescriptor descriptor, D data) { return applyWorker(descriptor, data) && visitChildren(descriptor.getTypeParameters(), data) && visitChildren(descriptor.getExtensionReceiverParameter(), data) && visitChildren(descriptor.getValueParameters(), data); }
processCallable
54,499
Boolean (PackageFragmentDescriptor descriptor, D data) { return applyWorker(descriptor, data) && visitChildren(DescriptorUtils.getAllDescriptors(descriptor.getMemberScope()), data); }
visitPackageFragmentDescriptor