diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index b2469920e69..3a596f393fc 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -5308,6 +5308,10 @@ and TcExprThen (cenv: cenv) overallTy env tpenv isArg synExpr delayed = // f(x) // hpa=true // f[x] // hpa=true | SynExpr.App (hpa, isInfix, func, arg, mFuncAndArg) -> + match func with + | SynExpr.DotLambda _ -> errorR(Error(FSComp.SR.tcDotLambdaAtNotSupportedExpression(), func.Range)) + | _ -> () + TcNonControlFlowExpr env <| fun env -> CheckForAdjacentListExpression cenv synExpr hpa isInfix delayed arg diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 23ebc9e4c7c..1b129ddbf0a 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1715,7 +1715,6 @@ featureStaticLetInRecordsDusEmptyTypes,"Allow static let bindings in union, reco 3568,parsMissingKeyword,"Missing keyword '%s'" 3569,chkNotTailRecursive,"The member or function '%s' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way." 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" 3572,parsConstraintIntersectionSyntaxUsedWithNonFlexibleType,"Constraint intersection syntax may only be used with flexible types, e.g. '#IDisposable & #ISomeInterface'." 3573,tcStaticBindingInExtrinsicAugmentation,"Static bindings cannot be added to extrinsic augmentations. Consider using a 'static member' instead." diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 38d01ec99d7..3a9e75023cd 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4884,15 +4884,6 @@ atomicExpr: 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 diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index f101b4c9151..1c259e2f89e 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -922,11 +922,6 @@ 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. - _. zkrácenou syntaxi pro funkce lambda lze použít pouze s atomickými výrazy. To znamená výrazy bez prázdných znaků, pokud nejsou uzavřené v závorkách. - - 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>. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 3697859d684..d0afa4dc1da 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -922,11 +922,6 @@ 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. - Die Kurzschreibweise _. für Lambdafunktionen kann nur mit atomischen Ausdrücken verwendet werden. Damit sind Ausdrücke ohne Leerraumzeichen oder in Klammern eingeschlossene Ausdrücke gemeint. - - 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>". diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 0d6054100c1..dd9b6b2c6aa 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -922,11 +922,6 @@ 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. - _. la sintaxis abreviada para las funciones lambda solo se puede usar con expresiones atómicas. Esto significa expresiones sin espacios en blanco a menos que se incluyan entre paréntesis. - - 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>". diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 14306dddc9e..3248f827f8a 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -922,11 +922,6 @@ 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. - _. La syntaxe abrégée pour les fonctions lambda ne peut être utilisée qu'avec des expressions atomiques. Cela signifie des expressions sans espace, sauf si elles sont placées entre parenthèses. - - 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>'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index cab10c51095..3ad9220be4d 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -922,11 +922,6 @@ 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. - la sintassi abbreviata _.per le funzioni lambda può essere usata solo con espressioni atomiche. Ciò significa espressioni senza spazi vuoti a meno che non siano racchiuse tra parentesi. - - 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>'. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 8aab74f4e4f..5118115f6d8 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -922,11 +922,6 @@ このメンバーへのアクセスはあいまいです。オブジェクト作成の前後にはかっこを使用してください。例: '(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. - _.ラムダ関数の短縮形構文は、アトミック式でのみ使用できます。つまり、かっこで囲まれていない限り、空白を含む式はありません。 - - 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>' が必要でした。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 9b3582eb4f8..9db4b87c842 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -922,11 +922,6 @@ 이 구성원 액세스가 모호합니다. 개체 생성 주위에 괄호를 사용하세요. 예: '(새로운 SomeType(인수)).MemberName' - - _. 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>'이 필요합니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 89867c0f85d..fa18e62c72c 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -922,11 +922,6 @@ 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. - _. składni skrótu dla funkcji lambda można używać tylko z wyrażeniami niepodzielnymi. Oznacza to wyrażenia bez białych znaków, chyba że są ujęte w nawiasy. - - 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>”. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index cff08b64683..6aab0f50014 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -922,11 +922,6 @@ 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. - A abreviação de sintaxe _. para funções lambda só pode ser usada com expressões atômicas. Isso significa expressões sem espaço em branco, a menos que entre parênteses. - - 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>'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 3349417fdf5..9ac45ca9885 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -922,11 +922,6 @@ Неоднозначный доступ к этому элементу. Заключите операцию создания объекта в круглые скобки, например (new Объект(аргументы)).Элемент - - _. 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>" diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 53aa7e0df1b..04e819d1191 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -922,11 +922,6 @@ 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. - _. lambda işlevleri için kısaltma, yalnızca atomik ifadelerle kullanılabilir. Bu, parantez içine alınmadıkça boşluk içermeyen ifadeler anlamına gelir. - - 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. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 097bc9c2e0b..36e98226860 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -922,11 +922,6 @@ 此成员访问权限不明确。请在对象创建周围使用括号,例如 “(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. - lambda 函数的 _. 速记语法只能与原子表达式一起使用。这意味着表达式没有空格,除非空格括在括号中。 - - 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>"。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index f9e2e228c79..fd2b6b77231 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -922,11 +922,6 @@ 此成員存取不明確。請在物件建立前後加上括弧,例如「(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. - 匿名函式的 _. 速記語法只能搭配不可部分完成的運算式使用。這表示沒有空白字元的運算式,除非以括弧括住。 - - 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>'. diff --git a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs index d47b891b169..a91045f49a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs @@ -18,6 +18,24 @@ printfn "%s" x""" |> typecheck |> shouldSucceed +[] +let ``Argument expression in inner app expression`` () = + Fsx """ +let x = List.map _.ToString() [1; 2; 3]""" + |> withLangVersion80 + |> typecheck + |> shouldSucceed + +[] +let ``Argument to a function expression - should fail`` () = + Fsx """ +type Person = { DrawFromBox : int -> string } +let x : Person -> string = _.DrawFromBox 123""" + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withErrorCodes [3584] + [] let ``Bug - constant lambdas are not part of this feature`` () = @@ -67,9 +85,12 @@ let x = "a" |> _.ToString () """ |> 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.")] - + Error 3584, Line 2, Col 16, Line 2, Col 26, "Shorthand lambda syntax is only supported for atomic expressions, such as method, property, field or indexer on the implied '_' argument. For example: 'let f = _.Length'." + Error 1, Line 2, Col 16, Line 2, Col 29, """Type mismatch. Expecting a + 'string -> 'a' +but given a + 'unit -> string' +The type 'string' does not match the type 'unit'""" ] [] let ``Underscore Dot Curried Function With Arguments - NonAtomic`` () = @@ -80,9 +101,10 @@ let myFunction (x:MyRecord) = x |> _.DoStuff 1 2 3""" |> withLangVersion80 |> 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.")] + |> withDiagnostics [ + Error 3584, Line 4, Col 36, Line 4, Col 45, "Shorthand lambda syntax is only supported for atomic expressions, such as method, property, field or indexer on the implied '_' argument. For example: 'let f = _.Length'." + Error 72, Line 4, Col 36, Line 4, Col 45, "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 ``Underscore Dot Length on string`` () = diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs.bsl b/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs.bsl deleted file mode 100644 index 6d432926d6b..00000000000 --- a/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs.bsl +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs new file mode 100644 index 00000000000..a24c602197c --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs @@ -0,0 +1 @@ +let _ = f _.P 123 \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs.bsl new file mode 100644 index 00000000000..ea3c2f9f236 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs.bsl @@ -0,0 +1,32 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/DotLambda_ArgumentExpressionInInnerAppExpression.fs", + false, + QualifiedNameOfFile DotLambda_ArgumentExpressionInInnerAppExpression, [], + [], + [SynModuleOrNamespace + ([DotLambda_ArgumentExpressionInInnerAppExpression], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None, + None), Wild (1,4--1,5), None, + App + (NonAtomic, false, + App + (NonAtomic, false, Ident f, + DotLambda + (Ident P, (1,10--1,13), + { UnderscoreRange = (1,10--1,11) + DotRange = (1,11--1,12) }), (1,8--1,13)), + Const (Int32 123, (1,14--1,17)), (1,8--1,17)), (1,4--1,5), + Yes (1,0--1,17), { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,6--1,7) })], + (1,0--1,17))], PreXmlDocEmpty, [], None, (1,0--1,17), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_FunctionWithUnderscoreDotLambda.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_FunctionWithUnderscoreDotLambda.fs diff --git a/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_FunctionWithUnderscoreDotLambda.fs.bsl similarity index 82% rename from tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs.bsl rename to tests/service/data/SyntaxTree/Expression/DotLambda_FunctionWithUnderscoreDotLambda.fs.bsl index ad7b91b3062..aec3a40ae97 100644 --- a/tests/service/data/SyntaxTree/DotLambda/FunctionWithUnderscoreDotLambda.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_FunctionWithUnderscoreDotLambda.fs.bsl @@ -1,9 +1,9 @@ ImplFile (ParsedImplFileInput - ("/root/DotLambda/FunctionWithUnderscoreDotLambda.fs", false, - QualifiedNameOfFile FunctionWithUnderscoreDotLambda, [], [], + ("/root/Expression/DotLambda_FunctionWithUnderscoreDotLambda.fs", false, + QualifiedNameOfFile DotLambda_FunctionWithUnderscoreDotLambda, [], [], [SynModuleOrNamespace - ([FunctionWithUnderscoreDotLambda], false, AnonModule, + ([DotLambda_FunctionWithUnderscoreDotLambda], false, AnonModule, [Let (false, [SynBinding diff --git a/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_NestedPropertiesAfterUnderscore.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_NestedPropertiesAfterUnderscore.fs diff --git a/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_NestedPropertiesAfterUnderscore.fs.bsl similarity index 84% rename from tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs.bsl rename to tests/service/data/SyntaxTree/Expression/DotLambda_NestedPropertiesAfterUnderscore.fs.bsl index 218580047ac..57d284dc75d 100644 --- a/tests/service/data/SyntaxTree/DotLambda/NestedPropertiesAfterUnderscore.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_NestedPropertiesAfterUnderscore.fs.bsl @@ -1,9 +1,9 @@ ImplFile (ParsedImplFileInput - ("/root/DotLambda/NestedPropertiesAfterUnderscore.fs", false, - QualifiedNameOfFile NestedPropertiesAfterUnderscore, [], [], + ("/root/Expression/DotLambda_NestedPropertiesAfterUnderscore.fs", false, + QualifiedNameOfFile DotLambda_NestedPropertiesAfterUnderscore, [], [], [SynModuleOrNamespace - ([NestedPropertiesAfterUnderscore], false, AnonModule, + ([DotLambda_NestedPropertiesAfterUnderscore], false, AnonModule, [Let (false, [SynBinding diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs new file mode 100644 index 00000000000..7ff3b6f27aa --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs @@ -0,0 +1 @@ +let _ = _.P 123 \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs.bsl new file mode 100644 index 00000000000..86e826b8007 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs.bsl @@ -0,0 +1,27 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/DotLambda_NotAllowedFunctionExpressionWithArg.fs", false, + QualifiedNameOfFile DotLambda_NotAllowedFunctionExpressionWithArg, [], [], + [SynModuleOrNamespace + ([DotLambda_NotAllowedFunctionExpressionWithArg], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None, + None), Wild (1,4--1,5), None, + App + (NonAtomic, false, + DotLambda + (Ident P, (1,8--1,11), { UnderscoreRange = (1,8--1,9) + DotRange = (1,9--1,10) }), + Const (Int32 123, (1,12--1,15)), (1,8--1,15)), (1,4--1,5), + Yes (1,0--1,15), { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,6--1,7) })], + (1,0--1,15))], PreXmlDocEmpty, [], None, (1,0--1,15), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelLet.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelLet.fs new file mode 100644 index 00000000000..35b8f582734 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelLet.fs @@ -0,0 +1 @@ +let _ = 1 |> _.ToString() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelLet.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelLet.fs.bsl new file mode 100644 index 00000000000..5fab8008612 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelLet.fs.bsl @@ -0,0 +1,37 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/DotLambda_TopLevelLet.fs", false, + QualifiedNameOfFile DotLambda_TopLevelLet, [], [], + [SynModuleOrNamespace + ([DotLambda_TopLevelLet], false, AnonModule, + [Let + (false, + [SynBinding + (None, Normal, false, false, [], + PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), + SynValData + (None, SynValInfo ([], SynArgInfo ([], false, None)), None, + None), Wild (1,4--1,5), None, + App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_PipeRight], [], [Some (OriginalNotation "|>")]), + None, (1,10--1,12)), Const (Int32 1, (1,8--1,9)), + (1,8--1,12)), + DotLambda + (App + (Atomic, false, Ident ToString, + Const (Unit, (1,23--1,25)), (1,15--1,25)), + (1,13--1,25), { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), (1,8--1,25)), + (1,4--1,5), NoneAtLet, { LeadingKeyword = Let (1,0--1,3) + InlineKeyword = None + EqualsRange = Some (1,6--1,7) })], + (1,0--1,25))], PreXmlDocEmpty, [], None, (1,0--1,25), + { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelStandaloneDotLambda.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelStandaloneDotLambda.fs new file mode 100644 index 00000000000..d341bfaa9c0 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelStandaloneDotLambda.fs @@ -0,0 +1 @@ +1 |> _.ToString() \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelStandaloneDotLambda.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelStandaloneDotLambda.fs.bsl new file mode 100644 index 00000000000..2c57852951a --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_TopLevelStandaloneDotLambda.fs.bsl @@ -0,0 +1,26 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/DotLambda_TopLevelStandaloneDotLambda.fs", false, + QualifiedNameOfFile DotLambda_TopLevelStandaloneDotLambda, [], [], + [SynModuleOrNamespace + ([DotLambda_TopLevelStandaloneDotLambda], false, AnonModule, + [Expr + (App + (NonAtomic, false, + App + (NonAtomic, true, + LongIdent + (false, + SynLongIdent + ([op_PipeRight], [], [Some (OriginalNotation "|>")]), + None, (1,2--1,4)), Const (Int32 1, (1,0--1,1)), + (1,0--1,4)), + DotLambda + (App + (Atomic, false, Ident ToString, Const (Unit, (1,15--1,17)), + (1,7--1,17)), (1,5--1,17), { UnderscoreRange = (1,5--1,6) + DotRange = (1,6--1,7) }), + (1,0--1,17)), (1,0--1,17))], PreXmlDocEmpty, [], None, + (1,0--1,17), { LeadingKeyword = None })], (true, true), + { ConditionalDirectives = [] + CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl similarity index 50% rename from tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl rename to tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl index 1aab8a5811d..eddb0cc21cc 100644 --- a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs.bsl @@ -1,11 +1,11 @@ ImplFile (ParsedImplFileInput - ("/root/DotLambda/UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs", + ("/root/Expression/DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication.fs", false, - QualifiedNameOfFile UnderscoreToFunctionNallWithSpaceAndUnitApplication, - [], [], + QualifiedNameOfFile + DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication, [], [], [SynModuleOrNamespace - ([UnderscoreToFunctionNallWithSpaceAndUnitApplication], false, + ([DotLambda_UnderscoreToFunctionNallWithSpaceAndUnitApplication], false, AnonModule, [Let (false, @@ -17,18 +17,16 @@ ImplFile 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), + App + (NonAtomic, false, + DotLambda + (Ident MyMethodCall, (1,13--1,27), + { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), Const (Unit, (1,28--1,30)), + (1,13--1,30)), (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/Expression/DotLambda_UnderscoreToString.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToString.fs diff --git a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToString.fs.bsl similarity index 61% rename from tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs.bsl rename to tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToString.fs.bsl index 66d4159e72a..177818e273f 100644 --- a/tests/service/data/SyntaxTree/DotLambda/UnderscoreToString.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_UnderscoreToString.fs.bsl @@ -1,9 +1,9 @@ ImplFile (ParsedImplFileInput - ("/root/DotLambda/UnderscoreToString.fs", false, - QualifiedNameOfFile UnderscoreToString, [], [], + ("/root/Expression/DotLambda_UnderscoreToString.fs", false, + QualifiedNameOfFile DotLambda_UnderscoreToString, [], [], [SynModuleOrNamespace - ([UnderscoreToString], false, AnonModule, + ([DotLambda_UnderscoreToString], false, AnonModule, [Expr (DotLambda (App @@ -14,5 +14,3 @@ ImplFile { 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/Expression/DotLambda_WithNonTupledFunctionCall.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_WithNonTupledFunctionCall.fs diff --git a/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_WithNonTupledFunctionCall.fs.bsl similarity index 51% rename from tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs.bsl rename to tests/service/data/SyntaxTree/Expression/DotLambda_WithNonTupledFunctionCall.fs.bsl index d764e98c83d..7562ce7b7a0 100644 --- a/tests/service/data/SyntaxTree/DotLambda/WithNonTupledFunctionCall.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_WithNonTupledFunctionCall.fs.bsl @@ -1,9 +1,9 @@ ImplFile (ParsedImplFileInput - ("/root/DotLambda/WithNonTupledFunctionCall.fs", false, - QualifiedNameOfFile WithNonTupledFunctionCall, [], [], + ("/root/Expression/DotLambda_WithNonTupledFunctionCall.fs", false, + QualifiedNameOfFile DotLambda_WithNonTupledFunctionCall, [], [], [SynModuleOrNamespace - ([WithNonTupledFunctionCall], false, AnonModule, + ([DotLambda_WithNonTupledFunctionCall], false, AnonModule, [Let (false, [SynBinding @@ -14,23 +14,21 @@ ImplFile None), Named (SynIdent (myFunc, None), false, None, (1,4--1,10)), None, - DotLambda - (App + App + (NonAtomic, false, + 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), + DotLambda + (Ident ThisIsMyFunction, (1,13--1,31), + { UnderscoreRange = (1,13--1,14) + DotRange = (1,14--1,15) }), Ident a, + (1,13--1,33)), Ident b, (1,13--1,35)), Ident c, + (1,13--1,37)), (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/Expression/DotLambda_WithoutDot.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_WithoutDot.fs diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_WithoutDot.fs.bsl similarity index 69% rename from tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs.bsl rename to tests/service/data/SyntaxTree/Expression/DotLambda_WithoutDot.fs.bsl index ebfb0fc358b..c9e140cb3a0 100644 --- a/tests/service/data/SyntaxTree/DotLambda/WithoutDot.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_WithoutDot.fs.bsl @@ -1,9 +1,9 @@ ImplFile (ParsedImplFileInput - ("/root/DotLambda/WithoutDot.fs", false, QualifiedNameOfFile WithoutDot, [], - [], + ("/root/Expression/DotLambda_WithoutDot.fs", false, + QualifiedNameOfFile DotLambda_WithoutDot, [], [], [SynModuleOrNamespace - ([WithoutDot], false, AnonModule, + ([DotLambda_WithoutDot], false, AnonModule, [Expr (App (Atomic, false, Ident _ToString, Const (Unit, (1,9--1,11)), diff --git a/tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs b/tests/service/data/SyntaxTree/Expression/DotLambda_WithoutUnderscore.fs similarity index 100% rename from tests/service/data/SyntaxTree/DotLambda/WithoutUnderscore.fs rename to tests/service/data/SyntaxTree/Expression/DotLambda_WithoutUnderscore.fs diff --git a/tests/service/data/SyntaxTree/Expression/DotLambda_WithoutUnderscore.fs.bsl b/tests/service/data/SyntaxTree/Expression/DotLambda_WithoutUnderscore.fs.bsl new file mode 100644 index 00000000000..624a15c29e4 --- /dev/null +++ b/tests/service/data/SyntaxTree/Expression/DotLambda_WithoutUnderscore.fs.bsl @@ -0,0 +1,11 @@ +ImplFile + (ParsedImplFileInput + ("/root/Expression/DotLambda_WithoutUnderscore.fs", false, + QualifiedNameOfFile DotLambda_WithoutUnderscore, [], [], + [SynModuleOrNamespace + ([DotLambda_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