Skip to content

Commit a9d473a

Browse files
committed
more diag updates
1 parent 13b4e07 commit a9d473a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

YarnSpinner.Compiler/DiagnosticDescriptor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,16 +619,16 @@ public string FormatMessage(params object[] args)
619619
);
620620

621621
/// <summary>
622-
/// YS0036: Preview feature not enabled.
622+
/// YS0036: Language version too low for feature.
623623
/// </summary>
624624
/// <remarks>
625625
/// <para>Format placeholders: 0: error message.</para>
626626
/// </remarks>
627-
public static readonly DiagnosticDescriptor PreviewFeatureRequired = new DiagnosticDescriptor(
627+
public static readonly DiagnosticDescriptor LanguageVersionTooLow = new DiagnosticDescriptor(
628628
code: "YS0036",
629629
messageTemplate: "{0}",
630630
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
631-
description: "A preview language feature was used but preview features are not enabled."
631+
description: "A language feature was used that requires a newer Yarn Spinner project version."
632632
);
633633

634634
/// <summary>
@@ -702,7 +702,7 @@ public string FormatMessage(params object[] args)
702702
{ EmptyNode.Code, EmptyNode },
703703
{ InvalidLibraryFunction.Code, InvalidLibraryFunction },
704704
{ EnumDeclarationError.Code, EnumDeclarationError },
705-
{ PreviewFeatureRequired.Code, PreviewFeatureRequired },
705+
{ LanguageVersionTooLow.Code, LanguageVersionTooLow },
706706
{ InvalidLiteralValue.Code, InvalidLiteralValue },
707707
{ InvalidMemberAccess.Code, InvalidMemberAccess },
708708
};

YarnSpinner.Compiler/Visitors/PreviewFeatureVisitor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ internal PreviewFeatureVisitor(FileParseResult file, int languageVersion, IList<
1616

1717
private void AddLanguageFeatureError(ParserRuleContext context, string featureType)
1818
{
19-
AddError(context, $"Language feature \"{featureType}\" is only available when preview features are enabled");
19+
AddError(context, $"Language feature \"{featureType}\" is not available at language version {LanguageVersion}; it requires version {Project.YarnSpinnerProjectVersion3} or later");
2020
}
2121

2222
private void AddError(ParserRuleContext context, string message)
2323
{
24-
var d = DiagnosticDescriptor.PreviewFeatureRequired.Create(File.Name, context, message);
24+
var d = DiagnosticDescriptor.LanguageVersionTooLow.Create(File.Name, context, message);
2525
this.Diagnostics.Add(d);
2626
}
2727

0 commit comments

Comments
 (0)