Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

G5V8DT-25016 В строгих типах Edt не понимает, что СправочникСсылка.ИмяСправочника входит в состав типа СправочникСсылка #1360 #1453

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import java.text.MessageFormat;

import com.google.inject.Inject;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
Expand All @@ -32,8 +30,8 @@
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;

Expand Down Expand Up @@ -68,9 +66,6 @@ public class BslDocCommentView
*/
public static final String ID = "com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"; //$NON-NLS-1$

@Inject
private IWorkbench workbench;

private TreeViewer viewer;

private ISelectionListener listener;
Expand Down Expand Up @@ -254,7 +249,7 @@ else if (obj instanceof ReturnSection || obj instanceof Section)
{
imageKey = ISharedImages.IMG_OBJ_FOLDER;
}
return workbench.getSharedImages().getImage(imageKey);
return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com._1c.g5.v8.dt.bsl.model.ReturnStatement;
import com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer;
import com._1c.g5.v8.dt.bsl.resource.TypesComputer;
import com._1c.g5.v8.dt.bsl.util.BslUtil;
import com._1c.g5.v8.dt.core.platform.IBmModelManager;
import com._1c.g5.v8.dt.core.platform.IResourceLookup;
import com._1c.g5.v8.dt.core.platform.IV8Project;
Expand Down Expand Up @@ -183,10 +184,7 @@ protected void checkDocumentationCommentObject(IDescriptionPart object, BslDocum

Set<String> checkTypes = getCheckTypes(parameters);

Set<String> computedReturnTypeNames = computedReturnTypes.stream()
.map(McoreUtil::getTypeName)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
Collection<String> computedReturnTypeNames = BslUtil.computeTypeNames(computedReturnTypes, method);

if (isUserDataTypes(computedReturnTypeNames, checkTypes))
{
Expand Down Expand Up @@ -269,11 +267,8 @@ private void checkTypeProperties(Function function, ReturnStatement statment, bo
{
String propertyName = useRussianScript ? declaredProperty.getNameRu() : declaredProperty.getName();
declaredProertyNames.add(propertyName);
List<String> declaredType = declaredProperty.getTypes()
.stream()
.map(McoreUtil::getTypeName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
Collection<String> declaredType =
com._1c.g5.v8.dt.bsl.util.BslUtil.computeTypeNames(declaredProperty.getTypes(), function);
if (declaredType.isEmpty())
{
continue;
Expand All @@ -287,7 +282,7 @@ private void checkTypeProperties(Function function, ReturnStatement statment, bo
.collect(Collectors.toList());

List<TypeItem> missingTypes = types.stream().filter(t -> {
String typeName = McoreUtil.getTypeName(t);
String typeName = McoreUtil.getTypeCategory(t);
if (typeName != null)
{
if (!declaredType.contains(typeName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,15 @@ Function CorrectCheckForCommonModule() Export
return new Structure("Key1, Key2", 10, CommonModule);
EndFunction

// Returns:
// Structure - complaint:
// * Ref - CatalogRef -
Function CorrectCheckForTypeSets() Export
EmptyRef = Catalogs.Catalog1.EmptyRef();
Str = Новый Structure;
Str.Вставить("Ref", EmptyRef);
Возврат Str;
EndFunction



Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ public void testFunctionCtorReturnSectionCheck() throws Exception

Module module = updateAndGetModule(checkId);

List<Function> finctions = EcoreUtil2.eAllOfType(module, Function.class);
assertEquals(4, finctions.size());
List<Function> functions = EcoreUtil2.eAllOfType(module, Function.class);
assertEquals(5, functions.size());

List<Marker> markers = getMarters(checkId, module);

Expand Down
Loading