Skip to content

Commit

Permalink
Inline check
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Oct 13, 2021
1 parent 71b5b2d commit 267fc94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ internal partial class Binder
private BoundExpression BindInterpolatedString(InterpolatedStringExpressionSyntax node, BindingDiagnosticBag diagnostics)
{
var startText = node.StringStartToken.Text;
if (startText.StartsWith("@$\""))
if (startText.StartsWith("@$\"") && !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings))
{
CheckFeatureAvailability(node, MessageID.IDS_FeatureAltInterpolatedVerbatimStrings, diagnostics, node.StringStartToken.GetLocation());
Error(diagnostics,
ErrorCode.ERR_AltInterpolatedVerbatimStringsNotAvailable,
node.StringStartToken.GetLocation(),
new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings.RequiredVersion()));
}

var builder = ArrayBuilder<BoundExpression>.GetInstance();
Expand Down
6 changes: 0 additions & 6 deletions src/Compilers/CSharp/Portable/Errors/MessageID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,6 @@ private static CSDiagnosticInfo GetDisabledFeatureDiagnosticInfo(MessageID featu
return new CSDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature);
}

// Special string we give to clarify the issue when @$" is used instead of $@".
if (feature == MessageID.IDS_FeatureAltInterpolatedVerbatimStrings)
{
return new CSDiagnosticInfo(ErrorCode.ERR_AltInterpolatedVerbatimStringsNotAvailable, new CSharpRequiredLanguageVersion(feature.RequiredVersion()));
}

LanguageVersion requiredVersion = feature.RequiredVersion();
return requiredVersion == LanguageVersion.Preview.MapSpecifiedToEffectiveVersion()
? new CSDiagnosticInfo(ErrorCode.ERR_FeatureInPreview, feature.Localize())
Expand Down

0 comments on commit 267fc94

Please sign in to comment.