1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2024-11-24 08:53:01 +02:00

G5V8DT-25016 В строгих типах Edt не понимает, что

СправочникСсылка.ИмяСправочника входит в состав типа
СправочникСсылка #1360
This commit is contained in:
Maxim Dzyuba 2024-06-28 15:37:41 +03:00
parent cdd4a707ea
commit 287dde0e08
4 changed files with 19 additions and 19 deletions

View File

@ -14,8 +14,6 @@ package com.e1c.v8codestyle.internal.bsl.ui.views;
import java.text.MessageFormat; import java.text.MessageFormat;
import com.google.inject.Inject;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.MenuManager;
@ -32,8 +30,8 @@ import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars; import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISharedImages; import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.part.ViewPart;
import org.eclipse.xtext.resource.EObjectAtOffsetHelper; import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
@ -68,9 +66,6 @@ public class BslDocCommentView
*/ */
public static final String ID = "com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"; //$NON-NLS-1$ public static final String ID = "com.e1c.v8codestyle.bsl.ui.views.BslDocCommentView"; //$NON-NLS-1$
@Inject
private IWorkbench workbench;
private TreeViewer viewer; private TreeViewer viewer;
private ISelectionListener listener; private ISelectionListener listener;
@ -254,7 +249,7 @@ public class BslDocCommentView
{ {
imageKey = ISharedImages.IMG_OBJ_FOLDER; imageKey = ISharedImages.IMG_OBJ_FOLDER;
} }
return workbench.getSharedImages().getImage(imageKey); return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
} }
} }

View File

@ -48,6 +48,7 @@ import com._1c.g5.v8.dt.bsl.model.Function;
import com._1c.g5.v8.dt.bsl.model.ReturnStatement; 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.DynamicFeatureAccessComputer;
import com._1c.g5.v8.dt.bsl.resource.TypesComputer; 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.IBmModelManager;
import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IResourceLookup;
import com._1c.g5.v8.dt.core.platform.IV8Project; import com._1c.g5.v8.dt.core.platform.IV8Project;
@ -183,10 +184,7 @@ public class FunctionCtorReturnSectionCheck
Set<String> checkTypes = getCheckTypes(parameters); Set<String> checkTypes = getCheckTypes(parameters);
Set<String> computedReturnTypeNames = computedReturnTypes.stream() Collection<String> computedReturnTypeNames = BslUtil.computeTypeNames(computedReturnTypes, method);
.map(McoreUtil::getTypeName)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (isUserDataTypes(computedReturnTypeNames, checkTypes)) if (isUserDataTypes(computedReturnTypeNames, checkTypes))
{ {
@ -269,11 +267,8 @@ public class FunctionCtorReturnSectionCheck
{ {
String propertyName = useRussianScript ? declaredProperty.getNameRu() : declaredProperty.getName(); String propertyName = useRussianScript ? declaredProperty.getNameRu() : declaredProperty.getName();
declaredProertyNames.add(propertyName); declaredProertyNames.add(propertyName);
List<String> declaredType = declaredProperty.getTypes() Collection<String> declaredType =
.stream() com._1c.g5.v8.dt.bsl.util.BslUtil.computeTypeNames(declaredProperty.getTypes(), function);
.map(McoreUtil::getTypeName)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (declaredType.isEmpty()) if (declaredType.isEmpty())
{ {
continue; continue;
@ -287,7 +282,7 @@ public class FunctionCtorReturnSectionCheck
.collect(Collectors.toList()); .collect(Collectors.toList());
List<TypeItem> missingTypes = types.stream().filter(t -> { List<TypeItem> missingTypes = types.stream().filter(t -> {
String typeName = McoreUtil.getTypeName(t); String typeName = McoreUtil.getTypeCategory(t);
if (typeName != null) if (typeName != null)
{ {
if (!declaredType.contains(typeName)) if (!declaredType.contains(typeName))

View File

@ -41,5 +41,15 @@ Function CorrectCheckForCommonModule() Export
return new Structure("Key1, Key2", 10, CommonModule); return new Structure("Key1, Key2", 10, CommonModule);
EndFunction EndFunction
// Returns:
// Structure - complaint:
// * Ref - CatalogRef -
Function CorrectCheckForTypeSets() Export
EmptyRef = Catalogs.Catalog1.EmptyRef();
Str = Новый Structure;
Str.Вставить("Ref", EmptyRef);
Возврат Str;
EndFunction

View File

@ -387,8 +387,8 @@ public class CommonModuleStrictTypesTest
Module module = updateAndGetModule(checkId); Module module = updateAndGetModule(checkId);
List<Function> finctions = EcoreUtil2.eAllOfType(module, Function.class); List<Function> functions = EcoreUtil2.eAllOfType(module, Function.class);
assertEquals(4, finctions.size()); assertEquals(5, functions.size());
List<Marker> markers = getMarters(checkId, module); List<Marker> markers = getMarters(checkId, module);