Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main to release/dev17.8 #15752

Merged
merged 5 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Compiler/Checking/CheckFormatStrings.fs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ let parseFormatStringInternal

// residue of hole "...{n}..." in interpolated strings become %P(...)
| 'P' when isInterpolated ->
let (code, message) = FSComp.SR.alwaysUseTypedStringInterpolation()
warning(DiagnosticWithText(code, message, m))
checkOtherFlags ch
let i = requireAndSkipInterpolationHoleFormat (i+1)
// Note, the fragCol doesn't advance at all as these are magically inserted.
Expand Down
3 changes: 2 additions & 1 deletion src/Compiler/Driver/CompilerDiagnostics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,14 @@ type PhasedDiagnostic with
| 1182 -> false // chkUnusedValue - off by default
| 3180 -> false // abImplicitHeapAllocation - off by default
| 3186 -> false // pickleMissingDefinition - off by default
| 3366 -> false //tcIndexNotationDeprecated - currently off by default
| 3366 -> false // tcIndexNotationDeprecated - currently off by default
| 3517 -> false // optFailedToInlineSuggestedValue - off by default
| 3388 -> false // tcSubsumptionImplicitConversionUsed - off by default
| 3389 -> false // tcBuiltInImplicitConversionUsed - off by default
| 3390 -> false // xmlDocBadlyFormed - off by default
| 3395 -> false // tcImplicitConversionUsedForMethodArg - off by default
| 3559 -> false // typrelNeverRefinedAwayFromTop - off by default
| 3579 -> false // alwaysUseTypedStringInterpolation - off by default
| _ ->
match x.Exception with
| DiagnosticEnabledWithLanguageFeature (_, _, _, enabled) -> enabled
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1721,3 +1721,4 @@ featureAccessorFunctionShorthand,"underscore dot shorthand for accessor only fun
3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c')."
featureUnmanagedConstraintCsharpInterop,"Interop between C#'s and F#'s unmanaged generic constraint (emit additional modreq)"
3578,chkCopyUpdateSyntaxInAnonRecords,"This expression is an anonymous record, use {{|...|}} instead of {{...}}."
3579,alwaysUseTypedStringInterpolation,"Interpolated string contains untyped identifiers. Adding typed format specifiers is recommended."
62 changes: 35 additions & 27 deletions src/Compiler/Service/ServiceParsedInputOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,12 @@ module ParsedInput =

| _ -> None

member _.VisitBinding(path, defaultTraverse, (SynBinding (headPat = headPat; trivia = trivia) as synBinding)) =
member _.VisitBinding
(
path,
defaultTraverse,
(SynBinding (headPat = headPat; trivia = trivia; returnInfo = returnInfo) as synBinding)
) =

let isOverride leadingKeyword =
match leadingKeyword with
Expand All @@ -1431,38 +1436,41 @@ module ParsedInput =
Some(CompletionContext.MethodOverride enclosingType.idRange)
| _ -> Some CompletionContext.Invalid

match headPat with
match returnInfo with
| Some (SynBindingReturnInfo (range = m)) when rangeContainsPos m pos -> Some CompletionContext.Type
| _ ->
match headPat with

// override _.|
| SynPat.FromParseError _ when isOverride trivia.LeadingKeyword -> overrideContext path
// override _.|
| SynPat.FromParseError _ when isOverride trivia.LeadingKeyword -> overrideContext path

// override this.|
| SynPat.Named(ident = SynIdent (ident = selfId)) when
isOverride trivia.LeadingKeyword && selfId.idRange.End.IsAdjacentTo pos
->
overrideContext path
// override this.|
| SynPat.Named(ident = SynIdent (ident = selfId)) when
isOverride trivia.LeadingKeyword && selfId.idRange.End.IsAdjacentTo pos
->
overrideContext path

// override this.ToStr|
| SynPat.LongIdent(longDotId = SynLongIdent(id = [ _; methodId ])) when
isOverride trivia.LeadingKeyword && rangeContainsPos methodId.idRange pos
->
overrideContext path
// override this.ToStr|
| SynPat.LongIdent(longDotId = SynLongIdent(id = [ _; methodId ])) when
isOverride trivia.LeadingKeyword && rangeContainsPos methodId.idRange pos
->
overrideContext path

| SynPat.LongIdent (longDotId = lidwd; argPats = SynArgPats.Pats pats; range = m) when rangeContainsPos m pos ->
if rangeContainsPos lidwd.Range pos then
// let fo|o x = ()
Some CompletionContext.Invalid
else
pats
|> List.tryPick (fun pat -> TryGetCompletionContextInPattern true pat None pos)
|> Option.orElseWith (fun () -> defaultTraverse synBinding)
| SynPat.LongIdent (longDotId = lidwd; argPats = SynArgPats.Pats pats; range = m) when rangeContainsPos m pos ->
if rangeContainsPos lidwd.Range pos then
// let fo|o x = ()
Some CompletionContext.Invalid
else
pats
|> List.tryPick (fun pat -> TryGetCompletionContextInPattern true pat None pos)
|> Option.orElseWith (fun () -> defaultTraverse synBinding)

| SynPat.Named (range = range)
| SynPat.As (_, SynPat.Named (range = range), _) when rangeContainsPos range pos ->
// let fo|o = 1
Some CompletionContext.Invalid
| SynPat.Named (range = range)
| SynPat.As (_, SynPat.Named (range = range), _) when rangeContainsPos range pos ->
// let fo|o = 1
Some CompletionContext.Invalid

| _ -> defaultTraverse synBinding
| _ -> defaultTraverse synBinding

member _.VisitHashDirective(_, _directive, range) =
// No completions in a directive
Expand Down
5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compiler/xlf/FSComp.txt.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading