From 186f35fc9b68ff3c60b0223e1d8735dbd195bfba Mon Sep 17 00:00:00 2001 From: Adam Johnston Date: Wed, 13 Nov 2024 14:23:53 -0800 Subject: [PATCH] remove duplicate read/write only property warning from ScriptPropertiesGenerator --- .../ScriptPropertiesGenerator.cs | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs index fc67e4f5929..f192bf0fb76 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs @@ -423,25 +423,10 @@ namespace Godot.SourceGenerators if (exportAttr != null && propertySymbol != null) { - if (propertySymbol.GetMethod == null) + if (propertySymbol.GetMethod == null || propertySymbol.SetMethod == null || propertySymbol.SetMethod.IsInitOnly) { - // This should never happen, as we filtered WriteOnly properties, but just in case. - context.ReportDiagnostic(Diagnostic.Create( - Common.ExportedPropertyIsWriteOnlyRule, - propertySymbol.Locations.FirstLocationWithSourceTreeOrDefault(), - propertySymbol.ToDisplayString() - )); - return null; - } - - if (propertySymbol.SetMethod == null || propertySymbol.SetMethod.IsInitOnly) - { - // This should never happen, as we filtered ReadOnly properties, but just in case. - context.ReportDiagnostic(Diagnostic.Create( - Common.ExportedMemberIsReadOnlyRule, - propertySymbol.Locations.FirstLocationWithSourceTreeOrDefault(), - propertySymbol.ToDisplayString() - )); + // Exports can be neither read-only nor write-only but the diagnostic errors for properties are already + // reported by ScriptPropertyDefValGenerator.cs so just quit early here. return null; } }