diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index c2d004975b1..8953376d273 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -5524,7 +5524,15 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE TcNonControlFlowExpr env <| fun env -> CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy.Commit, env.AccessRights) TcConstExpr cenv overallTy env m tpenv synConst - + | SynExpr.DotLambda (synExpr, m, trivia) -> + if env.NameEnv.eUnqualifiedItems |> Map.containsKey "_arg1" + then + warning(Error(FSComp.SR.tcAmbiguousDiscardDotLambda(), trivia.UnderscoreRange)) + let unaryArg = mkSynId trivia.UnderscoreRange (cenv.synArgNameGenerator.New()) + let svar = mkSynCompGenSimplePatVar unaryArg + let pushedExpr = pushUnaryArg synExpr unaryArg + let lambda = SynExpr.Lambda(false, false, SynSimplePats.SimplePats([ svar ],[], svar.Range), pushedExpr, None, m, SynExprLambdaTrivia.Zero) + TcIteratedLambdas cenv true env overallTy Set.empty tpenv lambda | SynExpr.Lambda _ -> TcIteratedLambdas cenv true env overallTy Set.empty tpenv synExpr @@ -8721,6 +8729,7 @@ and TcImplicitOpItemThen (cenv: cenv) overallTy env id sln tpenv mItem delayed = | SynExpr.Const _ | SynExpr.Typar _ | SynExpr.LongIdent _ + | SynExpr.DotLambda _ | SynExpr.Dynamic _ -> true | SynExpr.Tuple (_, synExprs, _, _) diff --git a/src/Compiler/Checking/MethodCalls.fs b/src/Compiler/Checking/MethodCalls.fs index 67b3a61fd5c..d7e09b86aeb 100644 --- a/src/Compiler/Checking/MethodCalls.fs +++ b/src/Compiler/Checking/MethodCalls.fs @@ -841,6 +841,7 @@ let InferLambdaArgsForLambdaPropagation origRhsExpr = match e with | SynExpr.Lambda (body = rest) -> 1 + loop rest | SynExpr.MatchLambda _ -> 1 + | SynExpr.DotLambda _ -> 1 | _ -> 0 loop origRhsExpr diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index b0b44e941fb..e4cf512ed80 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -362,6 +362,7 @@ let visitSynExpr (e: SynExpr) : FileContentEntry list = | SynExpr.IndexFromEnd (expr, _) -> visit expr continuation | SynExpr.ComputationExpr (expr = expr) -> visit expr continuation | SynExpr.Lambda (args = args; body = body) -> visit body (fun bodyNodes -> visitSynSimplePats args @ bodyNodes |> continuation) + | SynExpr.DotLambda (expr = expr) -> visit expr continuation | SynExpr.MatchLambda (matchClauses = clauses) -> List.collect visitSynMatchClause clauses |> continuation | SynExpr.Match (expr = expr; clauses = clauses) -> visit expr (fun exprNodes -> diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index cbc186a3a87..cb994d5cff8 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1701,6 +1701,9 @@ featureStaticLetInRecordsDusEmptyTypes,"Allow static let bindings in union, reco 3566,tcMultipleRecdTypeChoice,"Multiple type matches were found:\n%s\nThe type '%s' was used. Due to the overlapping field names\n%s\nconsider using type annotations or change the order of open statements." 3567,parsMissingMemberBody,"Expecting member body" 3568,parsMissingKeyword,"Missing keyword '%s'" +3570,tcAmbiguousDiscardDotLambda,"The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope." +3571,parsUnderScoreDotLambdaNonAtomic," _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses." +featureAccessorFunctionShorthand,"underscore dot shorthand for accessor only function" 3569,chkNotTailRecursive,"The member or function '%s' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." 3570,tcStaticBindingInExtrinsicAugmentation,"Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead." 3571,pickleFsharpCoreBackwardsCompatible,"Newly added pickle state cannot be used in FSharp.Core, since it must be working in older compilers+tooling as well. The time window is at least 3 years after feature introduction. Violation: %s . Context: \n %s " diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index b925a00c686..fb055f12c9e 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -55,6 +55,7 @@ type LanguageFeature = | LowercaseDUWhenRequireQualifiedAccess | InterfacesWithAbstractStaticMembers | SelfTypeConstraints + | AccessorFunctionShorthand | MatchNotAllowedForUnionCaseWithNoData | CSharpExtensionAttributeNotRequired | ErrorForNonVirtualMembersOverrides @@ -150,6 +151,7 @@ type LanguageVersion(versionText) = // F# preview LanguageFeature.FromEndSlicing, previewVersion + LanguageFeature.AccessorFunctionShorthand, previewVersion LanguageFeature.MatchNotAllowedForUnionCaseWithNoData, previewVersion LanguageFeature.CSharpExtensionAttributeNotRequired, previewVersion LanguageFeature.ErrorForNonVirtualMembersOverrides, previewVersion @@ -275,6 +277,7 @@ type LanguageVersion(versionText) = | LanguageFeature.LowercaseDUWhenRequireQualifiedAccess -> FSComp.SR.featureLowercaseDUWhenRequireQualifiedAccess () | LanguageFeature.InterfacesWithAbstractStaticMembers -> FSComp.SR.featureInterfacesWithAbstractStaticMembers () | LanguageFeature.SelfTypeConstraints -> FSComp.SR.featureSelfTypeConstraints () + | LanguageFeature.AccessorFunctionShorthand -> FSComp.SR.featureAccessorFunctionShorthand () | LanguageFeature.MatchNotAllowedForUnionCaseWithNoData -> FSComp.SR.featureMatchNotAllowedForUnionCaseWithNoData () | LanguageFeature.CSharpExtensionAttributeNotRequired -> FSComp.SR.featureCSharpExtensionAttributeNotRequired () | LanguageFeature.ErrorForNonVirtualMembersOverrides -> FSComp.SR.featureErrorForNonVirtualMembersOverrides () diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index ac4311f40d0..ee05ed4bcea 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -45,6 +45,7 @@ type LanguageFeature = | LowercaseDUWhenRequireQualifiedAccess | InterfacesWithAbstractStaticMembers | SelfTypeConstraints + | AccessorFunctionShorthand | MatchNotAllowedForUnionCaseWithNoData | CSharpExtensionAttributeNotRequired | ErrorForNonVirtualMembersOverrides diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index 97f7c96acee..d820a887129 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -292,6 +292,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, // Capture the body of a lambda, often nested in a call to a collection function | SynExpr.Lambda (body = body) when rangeContainsPos body.Range pos -> getIdentRangeForFuncExprInApp traverseSynExpr body pos + | SynExpr.DotLambda (expr = body) when rangeContainsPos body.Range pos -> getIdentRangeForFuncExprInApp traverseSynExpr body pos + | SynExpr.Do (expr, range) when rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos | SynExpr.Assert (expr, range) when rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos @@ -425,6 +427,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, override _.VisitBinding(_path, defaultTraverse, binding) = match binding with | SynBinding(expr = SynExpr.Lambda _) when skipLambdas -> defaultTraverse binding + | SynBinding(expr = SynExpr.DotLambda _) when skipLambdas -> defaultTraverse binding // Skip manually type-annotated bindings | SynBinding(returnInfo = Some (SynBindingReturnInfo _)) -> defaultTraverse binding @@ -533,6 +536,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynBinding.SynBinding (expr = expr; range = range) when Position.posEq range.Start pos -> match expr with | SynExpr.Lambda _ -> Some range + | SynExpr.DotLambda _ -> Some range | _ -> None | _ -> defaultTraverse binding } @@ -667,6 +671,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, match expr with | SynExpr.ArbitraryAfterError _ | SynExpr.LongIdent _ + | SynExpr.DotLambda _ | SynExpr.LibraryOnlyILAssembly _ | SynExpr.LibraryOnlyStaticOptimization _ | SynExpr.Null _ @@ -828,6 +833,8 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynExpr.Lambda (body = bodyExpr) -> yield! walkExpr true bodyExpr + | SynExpr.DotLambda (expr = bodyExpr) -> yield! walkExpr true bodyExpr + | SynExpr.Match (matchDebugPoint = spBind; expr = inpExpr; clauses = cl) -> yield! walkBindSeqPt spBind yield! walkExpr false inpExpr diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index e0e31850e33..7e5851cb329 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -880,6 +880,8 @@ module InterfaceStubGenerator = | SynExpr.Lambda (body = synExpr) -> walkExpr synExpr + | SynExpr.DotLambda (expr = synExpr) -> walkExpr synExpr + | SynExpr.MatchLambda (_isExnMatch, _argm, synMatchClauseList, _spBind, _wholem) -> synMatchClauseList |> List.tryPick (fun (SynMatchClause (resultExpr = e)) -> walkExpr e) diff --git a/src/Compiler/Service/ServiceParseTreeWalk.fs b/src/Compiler/Service/ServiceParseTreeWalk.fs index b6f95d66a30..5f0d189c3be 100644 --- a/src/Compiler/Service/ServiceParseTreeWalk.fs +++ b/src/Compiler/Service/ServiceParseTreeWalk.fs @@ -561,6 +561,8 @@ module SyntaxTraversal = | None -> traverseSynExpr synExpr | x -> x + | SynExpr.DotLambda (expr = e) -> traverseSynExpr e + | SynExpr.MatchLambda (_isExnMatch, _argm, synMatchClauseList, _spBind, _wholem) -> synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path)) diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 4b66db0d4fd..3975c995e18 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -752,6 +752,8 @@ module ParsedInput = | SynExpr.Lambda (body = e) -> walkExprWithKind parentKind e + | SynExpr.DotLambda (expr = e) -> walkExprWithKind parentKind e + | SynExpr.MatchLambda (_, _, synMatchClauseList, _, _) -> List.tryPick walkClause synMatchClauseList | SynExpr.Match (expr = e; clauses = synMatchClauseList) -> @@ -1739,6 +1741,7 @@ module ParsedInput = | SynExpr.Lambda (args = pats; body = e) -> walkSimplePats pats walkExpr e + | SynExpr.DotLambda (expr = e) -> walkExpr e | SynExpr.New (_, t, e, _) | SynExpr.TypeTest (e, t, _) | SynExpr.Upcast (e, t, _) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 2dd3dc51291..b747a57d987 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -618,6 +618,8 @@ type SynExpr = | DotGet of expr: SynExpr * rangeOfDot: range * longDotId: SynLongIdent * range: range + | DotLambda of expr: SynExpr * range: range * trivia: SynExprDotLambdaTrivia + | DotSet of targetExpr: SynExpr * longDotId: SynLongIdent * rhsExpr: SynExpr * range: range | Set of targetExpr: SynExpr * rhsExpr: SynExpr * range: range @@ -755,6 +757,7 @@ type SynExpr = | SynExpr.DotIndexedGet (range = m) | SynExpr.DotIndexedSet (range = m) | SynExpr.DotGet (range = m) + | SynExpr.DotLambda (range = m) | SynExpr.DotSet (range = m) | SynExpr.Set (range = m) | SynExpr.DotNamedIndexedPropertySet (range = m) diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index d7f01cd4889..de35bb01798 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -770,6 +770,9 @@ type SynExpr = /// F# syntax: expr.ident.ident | DotGet of expr: SynExpr * rangeOfDot: range * longDotId: SynLongIdent * range: range + /// F# syntax: _.ident.ident + | DotLambda of expr: SynExpr * range: range * trivia: SynExprDotLambdaTrivia + /// F# syntax: expr.ident...ident <- expr | DotSet of targetExpr: SynExpr * longDotId: SynLongIdent * rhsExpr: SynExpr * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index f25b7abb37f..73cf3f25063 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -63,6 +63,42 @@ let mkSynSimplePatVar isOpt id = let mkSynCompGenSimplePatVar id = SynSimplePat.Id(id, None, true, false, false, id.idRange) +let rec pushUnaryArg expr arg = + match expr with + | SynExpr.App (ExprAtomicFlag.Atomic, infix, SynExpr.Ident ident, x1, m1) -> + SynExpr.App( + ExprAtomicFlag.Atomic, + infix, + SynExpr.LongIdent(false, SynLongIdent(arg :: ident :: [], [ ident.idRange ], [ None ]), None, ident.idRange), + x1, + m1 + ) + | SynExpr.App (ExprAtomicFlag.Atomic, + infix, + SynExpr.LongIdent (isOptional, SynLongIdent (id, dotRanges, trivia), altNameRefCell, range), + x1, + m1) -> + SynExpr.App( + ExprAtomicFlag.Atomic, + infix, + SynExpr.LongIdent(isOptional, SynLongIdent(arg :: id, dotRanges, trivia), altNameRefCell, range), + x1, + m1 + ) + | SynExpr.App (ExprAtomicFlag.Atomic, infix, (SynExpr.App (_) as innerApp), x1, m1) -> + SynExpr.App(ExprAtomicFlag.Atomic, infix, (pushUnaryArg innerApp arg), x1, m1) + | SynExpr.App (ExprAtomicFlag.Atomic, infix, SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range), x1, m1) -> + SynExpr.App(ExprAtomicFlag.Atomic, infix, SynExpr.DotGet((pushUnaryArg synExpr arg), rangeOfDot, synLongIdent, range), x1, m1) + | SynExpr.App (ExprAtomicFlag.Atomic, infix, innerExpr, x1, m1) -> + SynExpr.App(ExprAtomicFlag.Atomic, infix, pushUnaryArg innerExpr arg, x1, m1) + | SynExpr.Ident ident -> SynExpr.LongIdent(false, SynLongIdent(arg :: ident :: [], [ ident.idRange ], [ None ]), None, ident.idRange) + | SynExpr.LongIdent (isOptional, SynLongIdent (id, dotRanges, trivia), altNameRefCell, range) -> + SynExpr.LongIdent(isOptional, SynLongIdent(arg :: id, dotRanges, trivia), altNameRefCell, range) + | SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range) -> SynExpr.DotGet(pushUnaryArg synExpr arg, rangeOfDot, synLongIdent, range) + | SynExpr.DotIndexedGet (objectExpr, indexArgs, dotRange, range) -> + SynExpr.DotIndexedGet(pushUnaryArg objectExpr arg, indexArgs, dotRange, range) + | _ -> expr + let (|SynSingleIdent|_|) x = match x with | SynLongIdent ([ id ], _, _) -> Some id @@ -792,6 +828,7 @@ let rec synExprContainsError inpExpr = | SynExpr.ArbitraryAfterError _ -> true | SynExpr.LongIdent _ + | SynExpr.DotLambda _ | SynExpr.Quote _ | SynExpr.LibraryOnlyILAssembly _ | SynExpr.LibraryOnlyStaticOptimization _ diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index 7e6d135d874..5a2819fcebb 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -41,6 +41,8 @@ val mkSynSimplePatVar: isOpt: bool -> id: Ident -> SynSimplePat val mkSynCompGenSimplePatVar: id: Ident -> SynSimplePat +val pushUnaryArg: expr: SynExpr -> arg: Ident -> SynExpr + /// Match a long identifier, including the case for single identifiers which gets a more optimized node in the syntax tree. val (|LongOrSingleIdent|_|): inp: SynExpr -> (bool * SynLongIdent * SynSimplePatAlternativeIdInfo ref option * range) option diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 497c666f1d6..ce7808fd575 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -75,6 +75,13 @@ type SynExprLambdaTrivia = static member Zero: SynExprLambdaTrivia = { ArrowRange = None } +[] +type SynExprDotLambdaTrivia = + { + UnderscoreRange: range + DotRange: range + } + [] type SynExprLetOrUseTrivia = { InKeyword: range option } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index fc28dc889b9..ae16ea6c556 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -119,6 +119,12 @@ type SynExprLambdaTrivia = static member Zero: SynExprLambdaTrivia +/// Represents additional information for SynExpr.DotLambda +[] +type SynExprDotLambdaTrivia = + { UnderscoreRange: range + DotRange: range } + /// Represents additional information for SynExpr.LetOrUse [] type SynExprLetOrUseTrivia = diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index f32554957eb..689739f7642 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -365,6 +365,7 @@ let parse_error_rich = Some(fun (ctxt: ParseErrorContext<_>) -> %left pat_app %left pat_args %left PREFIX_OP +%right dot_lambda %left DOT QMARK %left HIGH_PRECEDENCE_BRACK_APP %left HIGH_PRECEDENCE_PAREN_APP @@ -4791,6 +4792,23 @@ argExpr: arg } atomicExpr: + | UNDERSCORE DOT atomicExpr %prec dot_lambda + { let mUnderscore = rhs parseState 1 + let mDot = rhs parseState 2 + parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AccessorFunctionShorthand (unionRanges mUnderscore mDot ) + let expr, hpa = $3 + let trivia: SynExprDotLambdaTrivia = { UnderscoreRange = mUnderscore ; DotRange = mDot } + SynExpr.DotLambda(expr, unionRanges mUnderscore expr.Range, trivia), false } + + | UNDERSCORE DOT appExpr recover %prec dot_lambda + { let mUnderscore = rhs parseState 1 + let mDot = rhs parseState 2 + parseState.LexBuffer.CheckLanguageFeatureAndRecover LanguageFeature.AccessorFunctionShorthand (unionRanges mUnderscore mDot ) + reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnderScoreDotLambdaNonAtomic()) + let expr = $3 + let trivia: SynExprDotLambdaTrivia = { UnderscoreRange = mUnderscore ; DotRange = mDot } + SynExpr.DotLambda(expr, unionRanges mUnderscore expr.Range, trivia), false } + | atomicExpr HIGH_PRECEDENCE_BRACK_APP atomicExpr { let arg1, _ = $1 let arg2, hpa = $3 diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 7e15e96a41f..43e00f16f1e 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -182,6 +182,11 @@ Atribut sestavení {0} odkazuje na navržené sestavení {1}, které se nedá načíst nebo neexistuje. Ohlášená výjimka: {2} – {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions další převody orientované na typ @@ -857,6 +862,11 @@ Tento přístup člena je nejednoznačný. Při vytváření objektu použijte závorky, např. (new SomeType(args)).MemberName' + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Neočekávaný konec vstupu ve větvi else if nebo elif podmíněného výrazu Očekávalo se elif <expr> then <expr> nebo else if <expr> then <expr>. @@ -962,6 +972,11 @@ Sadu .NET SDK pro tento skript nešlo určit. Pokud se skript nachází v adresáři používajícím global.json, zkontrolujte, jestli je nainstalovaná odpovídající sada .NET SDK. Neočekávaná chyba {0}. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Tento výraz má typ {0} a je kompatibilní pouze s typem {1} prostřednictvím nejednoznačného implicitního převodu. Zvažte použití explicitního volání op_Implicit. Použitelnými implicitními převody jsou: {2} diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 8f933d1df9c..509d5b6f7d1 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -182,6 +182,11 @@ Das Assemblyattribut "{0}" verweist auf eine Designerassembly "{1}", die entweder nicht geladen werden kann oder nicht vorhanden ist. Gemeldete Ausnahme: {2} – {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions zusätzliche typgesteuerte Konvertierungen @@ -857,6 +862,11 @@ Dieser Memberzugriff ist mehrdeutig. Setzen Sie Klammern um die Objekterstellung, z. B. "(new SomeType(args)). MemberName“ + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Unerwartetes Ende der Eingabe im "else if"- oder "elif"-Branch des bedingten Ausdrucks. Erwartet wird: "elif <expr> then <expr>" oder "else if <expr> then <expr>". @@ -962,6 +972,11 @@ Das .NET SDK für dieses Skript konnte nicht ermittelt werden. Wenn sich das Skript in einem Verzeichnis mit "global.json" befindet, stellen Sie sicher, dass das entsprechende .NET SDK installiert ist. Unerwarteter Fehler: {0}. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Dieser Ausdruck weist den Typ "{0}" auf und wird nur durch eine mehrdeutige implizite Konvertierung mit dem Typ "{1}" kompatibel gemacht. Erwägen Sie die Verwendung eines expliziten Aufrufs an "op_Implicit". Die anwendbaren impliziten Konvertierungen sind: {2} diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index fe20735639c..f156ff9f0ee 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -182,6 +182,11 @@ El atributo de ensamblado "{0}" hace referencia a un ensamblado de diseñador "{1}" que no se puede cargar o no existe. Se notificó la excepción: {2} - {3}. + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions conversiones adicionales dirigidas a tipos @@ -857,6 +862,11 @@ Este acceso de miembro es ambiguo. Use paréntesis alrededor de la creación del objeto, por ejemplo, '(nuevo AlgúnTipo(args)).NombreMiembro' + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Fin de entrada inesperado en la rama "else if" o "elif" de una expresión condicional. Se espera "elif <expr> then <expr>" o "else if <expr> then <expr>". @@ -962,6 +972,11 @@ No se pudo determinar el SDK de .NET para este script. Si el script está en un directorio que usa una instancia de "global.json", asegúrese de que el SDK de .NET pertinente esté instalado. Error inesperado: "{0}". + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Esta expresión tiene el tipo "{0}" y solo se hace compatible con el tipo "{1}" mediante una conversión implícita ambigua. Considere la posibilidad de usar una llamada explícita a 'op_Implicit'. Las conversiones implícitas aplicables son:{2} diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 20b2477a8e3..c9437409d33 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -182,6 +182,11 @@ L'attribut d'assembly '{0}' fait référence à un assembly de concepteur '{1}' qui ne peut pas être chargé ou qui n'existe pas. Exception signalée : {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions conversions supplémentaires dirigées vers le type @@ -857,6 +862,11 @@ L’accès à ce membre est ambigu. Utilisez des parenthèses autour de la création de l’objet, par exemple' (New SomeType (args)). MemberName + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Fin d'entrée inattendue dans la branche 'else if' ou 'elif' de l'expression conditionnelle. Attendu 'elif <expr> then <expr>' ou 'else if <expr> then <expr>'. @@ -962,6 +972,11 @@ Le kit SDK .NET de ce script n'a pas pu être déterminé. Si le script se trouve dans un répertoire utilisant un fichier 'global.json', vérifiez que le kit SDK .NET approprié est installé. Erreur inattendue '{0}'. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Cette expression a le type « {0} » et est uniquement compatible avec le type « {1} » via une conversion implicite ambiguë. Envisagez d’utiliser un appel explicite à’op_Implicit'. Les conversions implicites applicables sont : {2} diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 06c045c7f01..e6ccf36a9a5 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -182,6 +182,11 @@ L'attributo di assembly '{0}' fa riferimento a un assembly '{1}' della finestra di progettazione che non è stato caricato o non esiste. L'eccezione restituita è {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions conversioni aggiuntive dirette ai tipi @@ -857,6 +862,11 @@ L'accesso ai membri è ambiguo. Utilizzare le parentesi intorno alla creazione oggetto, ad esempio “(New SomeType (args)). MemberName” + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Fine dell'input imprevista nel ramo 'else if' o 'elif' dell'espressione condizionale. È previsto 'elif <expr> then <expr>' o 'else if <expr> then <expr>'. @@ -962,6 +972,11 @@ Non è stato possibile determinare la versione di .NET SDK per questo script. Se lo script si trova in una directory che usa un file 'global.json', assicurarsi che sia installata la versione pertinente di .NET SDK. Errore imprevisto: '{0}'. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Questa espressione di tipo '{0}' è resa compatibile con il tipo '{1}' solo tramite una conversione implicita ambigua. Provare a usare una chiamata esplicita a 'op_Implicit'. Le conversioni implicite applicabili sono: {2} diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 9e37f0009cb..5be7a1c72a5 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -182,6 +182,11 @@ アセンブリ属性 '{0}' は、デザイナー アセンブリ '{1}' を参照していますが、これは読み込むことができないか、存在していません。報告された例外: {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions その他の型指定された変換 @@ -857,6 +862,11 @@ このメンバーへのアクセスはあいまいです。オブジェクト作成の前後にはかっこを使用してください。例: '(new SomeType(args)).MemberName' + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. 条件式の 'else if' または 'elif' 分岐の入力が予期しない形式で終了しています。'elif <expr> then <expr>' または 'else if <expr> then <expr>' が必要でした。 @@ -962,6 +972,11 @@ このスクリプトの .NET SDK を特定できませんでした。このスクリプトが、'global.json' が使用されているディレクトリにある場合は、関連する .NET SDK がインストールされていることを確認してください。予期しないエラー '{0}'。 + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} この式の型は '{0}' であり、あいまいで暗黙的な変換によってのみ、型 '{1}' と互換性を持たせることが可能です。' op_Implicit' の明示的な呼び出しを使用することを検討してください。該当する暗黙的な変換は次のとおりです: {2} diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 01aca747009..982f643df1c 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -182,6 +182,11 @@ '{0}' 어셈블리 특성이 로드할 수 없거나 존재하지 않는 디자이너 어셈블리'{1}'을(를) 참조합니다. 보고된 예외: {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions 추가 형식-디렉션 변환 @@ -857,6 +862,11 @@ 이 구성원 액세스가 모호합니다. 개체 생성 주위에 괄호를 사용하세요. 예: '(새로운 SomeType(인수)).MemberName' + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. 조건식의 'else if' 또는 'elif' 분기에서 입력이 예기치 않게 끝났습니다. 'elif <expr> then <expr>' 또는 'else if <expr> then <expr>'이 필요합니다. @@ -962,6 +972,11 @@ 이 스크립트에 대한 .NET SDK를 확인할 수 없습니다. 스크립트가 'global.json'을 사용하는 디렉터리에 있는 경우 관련 .NET SDK가 설치되어 있는지 확인하세요. 예기치 않은 오류 '{0}'. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} 이 식은 ‘{0}’ 형식이며 모호한 암시적 변환을 통해 ‘{1}’ 형식하고만 호환됩니다. ‘op_Implicit’에 대한 명시적 호출을 사용하십시오. 해당하는 암시적 변환은 ‘{2}’입니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index eac3adaa924..b12e5c1a1f2 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -182,6 +182,11 @@ Atrybut zestawu „{0}” odwołuje się do zestawu projektanta „{1}”, którego nie można załadować lub który nie istnieje. Zgłoszony wyjątek: {2} — {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions dodatkowe konwersje ukierunkowane na typ @@ -857,6 +862,11 @@ Dostęp tego elementu członkowskiego jest niejednoznaczny. W celu utworzenia obiektu użyj nawiasów, na przykład „(nowy SomeType(args)).MemberName” + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Nieoczekiwane zakończenie danych wejściowych w gałęzi „else” wyrażenia warunkowego. Oczekiwano konstrukcji „elif <expr> then <expr>” lub „else if <expr> then <expr>”. @@ -962,6 +972,11 @@ Nie można określić zestawu .NET SDK dla tego skryptu. Jeśli skrypt znajduje się w katalogu korzystającym z pliku „global.json”, upewnij się, że zainstalowano odpowiedni zestaw .NET SDK. Nieoczekiwany błąd: „{0}”. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} To wyrażenie ma typ "{0}" i jest zgodne tylko z typem "{1}" za pośrednictwem niejednoznacznie bezwarunkowej konwersji. Rozważ użycie jednoznacznego wywołania elementu "op_Implicit". Odpowiednimi jednoznacznymi konwersjami są: {2} diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 1566d205c87..691b1a7e34c 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -182,6 +182,11 @@ O atributo de assembly '{0}' refere-se a um assembly de designer '{1}' que não pode ser carregado ou que não existe. A exceção relatada foi {2} – {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions conversões direcionadas por tipos adicionais @@ -857,6 +862,11 @@ Este acesso de membro é ambíguo. Use parênteses em torno da criação do objeto, por exemplo, '(new SomeType(args)).MemberName''. + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Fim inesperado de entrada no branch 'else if' ou 'elif' da expressão condicional. Esperado 'elif <expr> em seguida, <expr>' ou 'else if <expr> then <expr>'. @@ -962,6 +972,11 @@ Não foi possível determinar o SDK do .NET deste script. Se o script estiver em um diretório que usa um 'global.json', verifique se o SDK do .NET relevante está instalado. Erro inesperado '{0}'. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Essa expressão possui o tipo '{0}' e só é compatível com o tipo '{1}' por uma conversão implícita ambígua. Considere usar uma chamada explícita para 'op_Implicit'. As conversões implícitas aplicáveis são:{2} diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index f387cc30205..5f6be141766 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -182,6 +182,11 @@ Атрибут сборки "{0}" ссылается на сборку конструктора "{1}", которая не может быть загружена или не существует. Получено исключение: {2} — {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions дополнительные преобразования на основе типа @@ -857,6 +862,11 @@ Неоднозначный доступ к этому элементу. Заключите операцию создания объекта в круглые скобки, например (new Объект(аргументы)).Элемент + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Неожиданное завершение входных данных ветви "else if" или "elif" условного выражения. Ожидается "elif <expr> then <expr> " или "else if <expr> then <expr>" @@ -962,6 +972,11 @@ Не удалось определить пакет SDK .NET для этого скрипта. Если сценарий находится в каталоге с использованием файла "global.json", убедитесь, что установлен соответствующий пакет SDK .NET. Непредвиденная ошибка "{0}". + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Это выражение имеет тип "{0}" и совместимо только с типом "{1}" посредством неоднозначного неявного преобразования. Рассмотрите возможность использования явного вызова "op_Implicit". Применимые неявные преобразования: {2} diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 30b832ad92d..d433d4c9416 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -182,6 +182,11 @@ '{0}' bütünleştirilmiş kod özniteliği, yüklenemeyen veya mevcut olmayan '{1}' tasarımcı bütünleştirilmiş koduna başvuruyor. Bildirilen özel durum: {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions ek tür ile yönlendirilen dönüştürmeler @@ -857,6 +862,11 @@ Bu üye erişimi belirsiz. Lütfen nesne oluşturma etrafında parantez kullanın, örneğin '(yeni SomeType (args)).MemberName’ + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. Koşullu ifadenin 'else if' veya 'elif' dalında beklenmeyen giriş sonu. 'elif <expr> then <expr>' veya 'else if <expr> then <expr>' bekleniyordu. @@ -962,6 +972,11 @@ Bu betik için .NET SDK belirlenemedi. Betik 'global.json' kullanan bir dizindeyse, ilgili .NET SDK'nın yüklü olduğundan emin olun. Beklenmeyen hata '{0}'. + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} Bu ifade '{0}' türüne sahip ve yalnızca belirsiz bir örtük dönüştürme aracılığıyla ’{1}' türüyle uyumlu hale getirilir. 'op_Implicit' için açık bir çağrı kullanmayı düşünün. Uygulanabilir örtük dönüştürmeler şunlardır: {2} diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 60fce95dda3..a6cde2b078b 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -182,6 +182,11 @@ 程序集属性“{0}”引用了无法加载或不存在的设计器程序集“{1}”。报告的异常是: {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions 附加类型定向转换 @@ -857,6 +862,11 @@ 此成员访问权限不明确。请在对象创建周围使用括号,例如 “(new SomeType(args)).MemberName” + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. 条件表达式的 "else if" 或 "elif" 分支中的输入意外结束。应为 "elif <expr> then <expr>" 或 "else if <expr> then <expr>"。 @@ -962,6 +972,11 @@ 无法确定此脚本的 .NET SDK。如果脚本在使用 "global.json" 的目录中,请确保已安装相关的 .NET SDK。出现意外错误“{0}”。 + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} 此表达式的类型为“{0}”,仅可通过不明确的隐式转换使其与类型“{1}”兼容。请考虑使用显式调用“op_Implicit”。适用的隐式转换为: {2} diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index be0d267a284..27c967818a2 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -182,6 +182,11 @@ 無法載入組件屬性 '{0}' 參考的設計工具組件 '{1}' 或其不存在。回報的例外狀況: {2} - {3} + + underscore dot shorthand for accessor only function + underscore dot shorthand for accessor only function + + additional type-directed conversions 其他類型導向轉換 @@ -857,6 +862,11 @@ 此成員存取不明確。請在物件建立前後加上括弧,例如「(new SomeType(args)).MemberName」 + + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. + + Unexpected end of input in 'else if' or 'elif' branch of conditional expression. Expected 'elif <expr> then <expr>' or 'else if <expr> then <expr>'. 條件運算式的 'else if' 或 'elif' 分支中出現未預期的輸入結尾。 預期為 'elif <expr> then <expr>' 或 'else if <expr> then <expr>'. @@ -962,6 +972,11 @@ 無法判斷這個指令碼的 .NET SDK。如果指令碼位於使用 'global.json' 的目錄中,請確認已安裝相關的 .NET SDK。未預期的錯誤 '{0}'。 + + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope. + + This expression has type '{0}' and is only made compatible with type '{1}' through an ambiguous implicit conversion. Consider using an explicit call to 'op_Implicit'. The applicable implicit conversions are:{2} 此運算式的類型為 '{0}',僅可透過不明確的隱含轉換使其與類型 '{1}' 相容。請考慮使用明確呼叫 'op_Implicit'。適用的隱含轉換為: {2} diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 498408f7ca7..45f82c3778c 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -184,6 +184,7 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs new file mode 100644 index 00000000000..f038fc67f10 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module Language.DotLambdaTests + +open Xunit +open FSharp.Test.Compiler + + + +// range test for _.ExistingProperty.NonExistingProperty + +[] +let ``Underscore Dot ToString`` () = + Fsx """ +let x = "a" |> _.ToString() +printfn "%s" x""" + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``Underscore Dot ToString With Space Before Paranthesis - NonAtomic`` () = + Fsx """ +let x = "a" |> _.ToString () """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 10, Line 2, Col 1, Line 2, Col 30, "Incomplete structured construct at or before this point in expression") + (Error 3571, Line 2, Col 16, Line 2, Col 17, " _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses.")] + + +[] +let ``Underscore Dot Curried Function With Arguments - NonAtomic`` () = + Fsx """ +type MyRecord = {MyRecordField:string} + with member x.DoStuff a b c = $"%s{x.MyRecordField} %i{a} %i{b} %i{c}" +let myFunction (x:MyRecord) = x |> _.DoStuff 1 2 3""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 10, Line 4, Col 1, Line 4, Col 51, "Incomplete structured construct at or before this point in expression") + (Error 3571, Line 4, Col 36, Line 4, Col 37, " _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses.")] + +[] +let ``Underscore Dot Length on string`` () = + Fsx """ +let x = "a" |> _.Length +printfn "%i" x +""" + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``Types`` () = + Fsx """ +let a : (string array -> _) = _.Length +let b = _.ToString() +let c = _.ToString().Length +//let c = _.ToString()[0] """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``Regression with an underscore using pattern match`` () = + Fsx """ +type MyDU = A | B +let getnumberOutOfDU x = + match x with + | A -> 42 + | _ -> 43""" + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``DotLambda does NOT generalize automatically to a member based SRTP`` () = + Fsx "let inline myFunc x = x |> _.WhatANiceProperty" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [(Error 72, Line 1, Col 28, Line 1, Col 47, "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.")] + +[] +let ``DotLambda does allow member based SRTP if labelled explicitely`` () = + Fsx "let inline myFunc<'a when 'a:(member WhatANiceProperty: int)> (x: 'a) = x |> _.WhatANiceProperty " + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``ToString with preview version`` () = + Fsx "let myFunc = _.ToString()" + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``Regression in neg typecheck hole as left arg`` () = + Fsx """ +let a = ( upcast _ ) : obj +let b = ( _ :> _ ) : obj +let c = ( _ :> obj) """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + Error 10, Line 2, Col 20, Line 2, Col 21, "Unexpected symbol ')' in expression. Expected '.' or other token." + Error 10, Line 3, Col 13, Line 3, Col 15, "Unexpected symbol ':>' in expression. Expected '.' or other token." + Error 583, Line 3, Col 9, Line 3, Col 10, "Unmatched '('" + Error 10, Line 4, Col 13, Line 4, Col 15, "Unexpected symbol ':>' in expression. Expected '.' or other token." + Error 583, Line 4, Col 9, Line 4, Col 10, "Unmatched '('"] + +[] +let ``ToString with F# 7`` () = + Fsx """let x = "a" |> _.ToString()""" + |> withLangVersion70 + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 3350, Line 1, Col 16, Line 1, Col 18, "Feature 'underscore dot shorthand for accessor only function' is not available in F# 7.0. Please use language version 'PREVIEW' or greater." ) + +[] +let ``Simple anonymous unary function shorthands compile`` () = + FSharp """ +module One +let a1 : {| Foo : {| Bar : string |}|} -> string = _.Foo.Bar +let a2 : {| Foo : int array |} -> int = _.Foo.[5] +let a3 : {| Foo : int array |} -> int = _.Foo[5] +let a4 : {| Foo : unit -> string |} -> string = _.Foo() +let a5 : {| Foo : int -> {| X : string |} |} -> string = _.Foo(5).X + +open System +let a6 = [1] |> List.map _.ToString() + """ + |> withLangVersionPreview + |> typecheck + |> shouldSucceed + +[] +let ``Nested anonymous unary function shorthands fails because of ambigous discard`` () = + FSharp """ +module One +let a : string = {| Inner = (fun x -> x.ToString()) |} |> _.Inner([5] |> _.[0]) + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3570, Line 3, Col 75, Line 3, Col 76, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope.") + +[] +let ``Anonymous unary function shorthand with conflicting wild argument`` () = + FSharp """ +module One +let a : string -> string = (fun _ -> 5 |> _.ToString()) +let b : int -> int -> string = function |5 -> (fun _ -> "Five") |_ -> _.ToString() +let c : string = let _ = "test" in "asd" |> _.ToString() + """ + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3570, Line 3, Col 43, Line 3, Col 44, "The meaning of _ is ambiguous here. It cannot be used for a discarded variable and a function shorthand in the same scope.") \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/underscore_dot_lambda.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/underscore_dot_lambda.fsx new file mode 100644 index 00000000000..b346d4e04bd --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/underscore_dot_lambda.fsx @@ -0,0 +1,9 @@ +module MyTests + +let printerFunc = _.ToString() + +let processString (x:string) = x |> _.Length + +type MyRecord = {ThisIsFieldOfMyRecord : string} + +let extractProp = _.ThisIsFieldOfMyRecord \ No newline at end of file diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 6a945e904ad..f005571e1dd 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -6320,6 +6320,12 @@ FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range get_lef FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range leftOfSetRange FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Syntax.SynExpr expr +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Syntax.SynExpr get_expr() +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia trivia +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet: FSharp.Compiler.Syntax.SynExpr argExpr FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet: FSharp.Compiler.Syntax.SynExpr get_argExpr() FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet: FSharp.Compiler.Syntax.SynExpr get_rhsExpr() @@ -6680,6 +6686,7 @@ FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DoBang FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotGet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotIndexedGet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotIndexedSet +FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotLambda FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotSet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Downcast @@ -6845,6 +6852,7 @@ FSharp.Compiler.Syntax.SynExpr: Boolean IsDoBang FSharp.Compiler.Syntax.SynExpr: Boolean IsDotGet FSharp.Compiler.Syntax.SynExpr: Boolean IsDotIndexedGet FSharp.Compiler.Syntax.SynExpr: Boolean IsDotIndexedSet +FSharp.Compiler.Syntax.SynExpr: Boolean IsDotLambda FSharp.Compiler.Syntax.SynExpr: Boolean IsDotNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr: Boolean IsDotSet FSharp.Compiler.Syntax.SynExpr: Boolean IsDowncast @@ -6914,6 +6922,7 @@ FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDoBang() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotGet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotIndexedGet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotIndexedSet() +FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotLambda() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotNamedIndexedPropertySet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotSet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDowncast() @@ -6982,6 +6991,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDoBang(FSharp. FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotLambda(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotNamedIndexedPropertySet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDowncast(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) @@ -7050,6 +7060,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DoBang FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotGet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotIndexedGet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotIndexedSet +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotLambda FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotSet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Downcast @@ -9397,6 +9408,12 @@ FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range O FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range get_OpeningBraceRange() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range DotRange +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range UnderscoreRange +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range get_DotRange() +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range get_UnderscoreRange() +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynExprIfThenElseTrivia: Boolean IsElif FSharp.Compiler.SyntaxTrivia.SynExprIfThenElseTrivia: Boolean get_IsElif() FSharp.Compiler.SyntaxTrivia.SynExprIfThenElseTrivia: FSharp.Compiler.Text.Range IfKeyword diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 4b71c5541fc..85c7de12d5e 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -6320,6 +6320,12 @@ FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range get_lef FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range get_range() FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range leftOfSetRange FSharp.Compiler.Syntax.SynExpr+DotIndexedSet: FSharp.Compiler.Text.Range range +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Syntax.SynExpr expr +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Syntax.SynExpr get_expr() +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia trivia +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.SynExpr+DotLambda: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet: FSharp.Compiler.Syntax.SynExpr argExpr FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet: FSharp.Compiler.Syntax.SynExpr get_argExpr() FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet: FSharp.Compiler.Syntax.SynExpr get_rhsExpr() @@ -6680,6 +6686,7 @@ FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DoBang FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotGet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotIndexedGet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotIndexedSet +FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotLambda FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 DotSet FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Downcast @@ -6845,6 +6852,7 @@ FSharp.Compiler.Syntax.SynExpr: Boolean IsDoBang FSharp.Compiler.Syntax.SynExpr: Boolean IsDotGet FSharp.Compiler.Syntax.SynExpr: Boolean IsDotIndexedGet FSharp.Compiler.Syntax.SynExpr: Boolean IsDotIndexedSet +FSharp.Compiler.Syntax.SynExpr: Boolean IsDotLambda FSharp.Compiler.Syntax.SynExpr: Boolean IsDotNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr: Boolean IsDotSet FSharp.Compiler.Syntax.SynExpr: Boolean IsDowncast @@ -6914,6 +6922,7 @@ FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDoBang() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotGet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotIndexedGet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotIndexedSet() +FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotLambda() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotNamedIndexedPropertySet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDotSet() FSharp.Compiler.Syntax.SynExpr: Boolean get_IsDowncast() @@ -6982,6 +6991,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDoBang(FSharp. FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotLambda(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotNamedIndexedPropertySet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDowncast(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) @@ -7050,6 +7060,7 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DoBang FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotGet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotIndexedGet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotIndexedSet +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotLambda FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotNamedIndexedPropertySet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+DotSet FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+Downcast @@ -9397,6 +9408,12 @@ FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range O FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: FSharp.Compiler.Text.Range get_OpeningBraceRange() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: System.String ToString() FSharp.Compiler.SyntaxTrivia.SynExprAnonRecdTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range DotRange +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range UnderscoreRange +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range get_DotRange() +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: FSharp.Compiler.Text.Range get_UnderscoreRange() +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprDotLambdaTrivia: Void .ctor(FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.SyntaxTrivia.SynExprIfThenElseTrivia: Boolean IsElif FSharp.Compiler.SyntaxTrivia.SynExprIfThenElseTrivia: Boolean get_IsElif() FSharp.Compiler.SyntaxTrivia.SynExprIfThenElseTrivia: FSharp.Compiler.Text.Range IfKeyword diff --git a/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/E_StaticCoercion_hole_as_left_arg.fsx b/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/E_StaticCoercion_hole_as_left_arg.fsx deleted file mode 100644 index d2c2dbf1fd0..00000000000 --- a/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/E_StaticCoercion_hole_as_left_arg.fsx +++ /dev/null @@ -1,15 +0,0 @@ -// #Regression #Conformance #TypeRelatedExpressions #TypeAnnotations -// Negative tests on :> -// Using _ as left argument - -//Unexpected symbol '_' in expression$ -//Unmatched '\('$ -//Unexpected symbol '_' in binding$ -//Unmatched '\('$ -//Unexpected symbol '_' in binding$ -//Unmatched '\('$ - - -let a = ( upcast _ ) : obj -let b = ( _ :> _ ) : obj -let c = ( _ :> obj) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/env.lst index fe2f99b812b..d6a3fed8253 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/Type-relatedExpressions/env.lst @@ -1,6 +1,5 @@ SOURCE=E_StaticCoercion_class_not_impl_iface.fsx SCFLAGS="--test:ErrorRanges" # E_StaticCoercion_class_not_impl_iface.fsx SOURCE=E_StaticCoercion_class_not_subclass.fsx SCFLAGS="--test:ErrorRanges" # E_StaticCoercion_class_not_subclass.fsx - SOURCE=E_StaticCoercion_hole_as_left_arg.fsx SCFLAGS="--test:ErrorRanges" # E_StaticCoercion_hole_as_left_arg.fsx SOURCE=StaticCoercion_class01.fsx # StaticCoercion_class01.fsx SOURCE=StaticCoercion_interface01.fsx # StaticCoercion_interface01.fsx SOURCE=StaticCoercion_interface02.fsx # StaticCoercion_interface02.fsx diff --git a/tests/service/CompletionTests.fs b/tests/service/CompletionTests.fs index 9aca58a6b5b..349647e0fa3 100644 --- a/tests/service/CompletionTests.fs +++ b/tests/service/CompletionTests.fs @@ -4,7 +4,7 @@ open FSharp.Compiler.EditorServices open NUnit.Framework let getCompletionInfo lineText (line, column) source = - let parseResults, checkResults = getParseAndCheckResults source + let parseResults, checkResults = getParseAndCheckResultsPreview source let plid = QuickParse.GetPartialLongNameEx(lineText, column) checkResults.GetDeclarationListInfo(Some parseResults, line, lineText, plid) @@ -15,7 +15,7 @@ let assertHasItemWithNames names (completionInfo: DeclarationListInfo) = let itemNames = getCompletionItemNames completionInfo |> set for name in names do - Assert.That(Set.contains name itemNames, name) + Assert.That(Set.contains name itemNames, $"{name} not found in {itemNames}") [] let ``Expr - record - field 01 - anon module`` () = @@ -55,4 +55,20 @@ let record = { Field = 1 } { } """ - assertHasItemWithNames ["Field"; "record"] info \ No newline at end of file + assertHasItemWithNames ["Field"; "record"] info + +[] +let ``Underscore dot lambda - completion`` () = + let info = getCompletionInfo " |> _.Len" (4, 11) """ +let myFancyFunc (x:string) = + x + |> _.Len""" + assertHasItemWithNames ["Length"] info + +[] +let ``Underscore dot lambda - method completion`` () = + let info = getCompletionInfo " |> _.ToL" (4, 11) """ +let myFancyFunc (x:string) = + x + |> _.ToL""" + assertHasItemWithNames ["ToLower"] info \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs b/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs new file mode 100644 index 00000000000..8f07a966861 --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs @@ -0,0 +1 @@ +let myFunc = _.MyProperty \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs.bsl new file mode 100644 index 00000000000..761e4d10bf1 --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs.bsl @@ -0,0 +1,25 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/FunctionWithUnderscoreDotLambda.fs", false, + QualifiedNameOfFile FunctionWithUnderscoreDotLambda, [], [], + [SynModuleOrNamespace + ([FunctionWithUnderscoreDotLambda], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (myFunc, None), false, None, (1,4--1,10)), + None, + DotLambda + (Ident MyProperty, (1,13--1,25), + { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), (1,4--1,10), Yes (1,0--1,25), + { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,11--1,12) })], (1,0--1,25))], + PreXmlDocEmpty, [], None, (1,0--1,25), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs b/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs new file mode 100644 index 00000000000..c98363d7506 --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs @@ -0,0 +1 @@ +let myFunc = _.MyProperty.MyOtherProperty \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs.bsl new file mode 100644 index 00000000000..2f6ac46b18d --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs.bsl @@ -0,0 +1,29 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/NestedPropertiesAfterUnderscore.fs", false, + QualifiedNameOfFile NestedPropertiesAfterUnderscore, [], [], + [SynModuleOrNamespace + ([NestedPropertiesAfterUnderscore], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (myFunc, None), false, None, (1,4--1,10)), + None, + DotLambda + (LongIdent + (false, + SynLongIdent + ([MyProperty; MyOtherProperty], [(1,25--1,26)], + [None; None]), None, (1,15--1,41)), (1,13--1,41), + { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), (1,4--1,10), Yes (1,0--1,41), + { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,11--1,12) })], (1,0--1,41))], + PreXmlDocEmpty, [], None, (1,0--1,41), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs new file mode 100644 index 00000000000..76174f54c6f --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs @@ -0,0 +1 @@ +let myFunc = _.MyMethodCall () \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl new file mode 100644 index 00000000000..db09884461c --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl @@ -0,0 +1,33 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs", + false, + QualifiedNameOfFile UnderscoreToFunctionNallWithSpaceAndUnitApplication, + [], [], + [SynModuleOrNamespace + ([UnderscoreToFunctionNallWithSpaceAndUnitApplication], false, + AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (myFunc, None), false, None, (1,4--1,10)), + None, + DotLambda + (App + (NonAtomic, false, Ident MyMethodCall, + Const (Unit, (1,28--1,30)), (1,15--1,30)), (1,13--1,30), + { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), (1,4--1,10), Yes (1,0--1,30), + { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,11--1,12) })], (1,0--1,30))], + PreXmlDocEmpty, [], None, (1,0--1,30), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(1,0)-(1,30) parse error Incomplete structured construct at or before this point in expression +(1,13)-(1,14) parse error _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs new file mode 100644 index 00000000000..afe271dc2b7 --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs @@ -0,0 +1 @@ +_.ToString() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs.bsl new file mode 100644 index 00000000000..66d4159e72a --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs.bsl @@ -0,0 +1,18 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/UnderscoreToString.fs", false, + QualifiedNameOfFile UnderscoreToString, [], [], + [SynModuleOrNamespace + ([UnderscoreToString], false, AnonModule, + [Expr + (DotLambda + (App + (Atomic, false, Ident ToString, Const (Unit, (1,10--1,12)), + (1,2--1,12)), (1,0--1,12), { UnderscoreRange = (1,0--1,1) + DotRange = (1,1--1,2) }), + (1,0--1,12))], PreXmlDocEmpty, [], None, (1,0--1,12), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(1,0)-(1,1) parse error _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. diff --git a/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs b/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs new file mode 100644 index 00000000000..b546f9b55de --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs @@ -0,0 +1 @@ +let myFunc = _.ThisIsMyFunction a b c \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs.bsl new file mode 100644 index 00000000000..0070d4d464c --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs.bsl @@ -0,0 +1,35 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/WithNonTupledFunctionCall.fs", false, + QualifiedNameOfFile WithNonTupledFunctionCall, [], [], + [SynModuleOrNamespace + ([WithNonTupledFunctionCall], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None), + Named (SynIdent (myFunc, None), false, None, (1,4--1,10)), + None, + DotLambda + (App + (NonAtomic, false, + App + (NonAtomic, false, + App + (NonAtomic, false, Ident ThisIsMyFunction, Ident a, + (1,15--1,33)), Ident b, (1,15--1,35)), Ident c, + (1,15--1,37)), (1,13--1,37), + { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), (1,4--1,10), Yes (1,0--1,37), + { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,11--1,12) })], (1,0--1,37))], + PreXmlDocEmpty, [], None, (1,0--1,37), { LeadingKeyword = None })], + (true, true), { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(1,0)-(1,37) parse error Incomplete structured construct at or before this point in expression +(1,13)-(1,14) parse error _. shorthand syntax for lambda functions can only be used with atomic expressions. That means expressions with no whitespace unless enclosed in parentheses. diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs b/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs new file mode 100644 index 00000000000..6bfa010ed2d --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs @@ -0,0 +1 @@ +_ToString() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs.bsl new file mode 100644 index 00000000000..ebfb0fc358b --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs.bsl @@ -0,0 +1,13 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/WithoutDot.fs", false, QualifiedNameOfFile WithoutDot, [], + [], + [SynModuleOrNamespace + ([WithoutDot], false, AnonModule, + [Expr + (App + (Atomic, false, Ident _ToString, Const (Unit, (1,9--1,11)), + (1,0--1,11)), (1,0--1,11))], PreXmlDocEmpty, [], None, + (1,0--1,11), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs b/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs new file mode 100644 index 00000000000..340a7bc7001 --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs @@ -0,0 +1 @@ +.ToString() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs.bsl new file mode 100644 index 00000000000..6d432926d6b --- /dev/null +++ b/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs.bsl @@ -0,0 +1,11 @@ +ImplFile + (ParsedImplFileInput + ("/root/DotLambda/WithoutUnderscore.fs", false, + QualifiedNameOfFile WithoutUnderscore, [], [], + [SynModuleOrNamespace + ([WithoutUnderscore], false, AnonModule, [], PreXmlDocEmpty, [], None, + (1,0--1,1), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) + +(1,0)-(1,1) parse error Unexpected symbol '.' in implementation file