internal static CSDiagnosticInfo?GetFeatureAvailabilityDiagnosticInfo( this MessageID feature, CSharpCompilation compilation ) => compilation.IsFeatureEnabled(feature) ? null : GetDisabledFeatureDiagnosticInfo(feature, compilation.LanguageVersion);
private static DiagnosticInfo ReportNullableReferenceTypesIfNeeded(CSharpCompilation compilation, INonNullTypesContext nonNullTypesContext) { var featureID = MessageID.IDS_FeatureNullableReferenceTypes; if (!compilation.IsFeatureEnabled(featureID)) { LanguageVersion availableVersion = compilation.LanguageVersion; LanguageVersion requiredVersion = featureID.RequiredVersion(); return(new CSDiagnosticInfo(availableVersion.GetErrorCode(), featureID.Localize(), new CSharpRequiredLanguageVersion(requiredVersion))); } else if (nonNullTypesContext.NonNullTypes != true) { return(new CSDiagnosticInfo(ErrorCode.WRN_MissingNonNullTypesContextForAnnotation)); } return(null); }