From d9c05602562faf814a44ac8f75f044caa45672a5 Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Sun, 4 Jun 2023 18:04:13 +0100 Subject: [PATCH 1/6] Introduces better diagnostic for overriding members with tuple arguments https://github.com/dotnet/fsharp/issues/15307 --- src/Compiler/Checking/CheckExpressions.fs | 20 +++++++++++++++---- src/Compiler/FSComp.txt | 1 + src/Compiler/xlf/FSComp.txt.cs.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.de.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.es.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.fr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.it.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ja.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ko.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pl.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ru.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 +++++ .../InterfaceImplInAugmentationsTests.fs | 15 +++++++++++++- 16 files changed, 96 insertions(+), 5 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index f18525f47f..db1d3cf17f 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -11091,13 +11091,25 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a errorR(Error(FSComp.SR.tcNoMemberFoundForOverride(), memberId.idRange)) [] - | slots -> + | slot :: _ as slots -> match dispatchSlotsArityMatch with | meths when methInfosEquivByNameAndSig meths -> meths | [] -> - let details = NicePrint.multiLineStringOfMethInfos cenv.infoReader m envinner.DisplayEnv slots - errorR(Error(FSComp.SR.tcOverrideArityMismatch details, memberId.idRange)) - [] + let raiseGenericArityMismatch() = + let details = NicePrint.multiLineStringOfMethInfos cenv.infoReader m envinner.DisplayEnv slots + errorR(Error(FSComp.SR.tcOverrideArityMismatch details, memberId.idRange)) + [] + + match slot with + | FSMeth (_, _, valRef, _) -> + match valRef.TauType with + // https://github.com/dotnet/fsharp/issues/15307 + // check if abstract method expects tuple, give better error message + | TType_fun(_,TType_fun(TType_tuple _,_,_),_) -> + errorR(Error(FSComp.SR.tcOverrideUsesMultipleArgumentsInsteadOfTuple(), memberId.idRange)) + [] + | _ -> raiseGenericArityMismatch() + | _ -> raiseGenericArityMismatch() | _ -> [] // check that method to override is sealed is located at CheckOverridesAreAllUsedOnce (typrelns.fs) // We hit this case when it is ambiguous which abstract method is being implemented. diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 479e11ad05..91f89da7f7 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1696,3 +1696,4 @@ featureEscapeBracesInFormattableString,"Escapes curly braces before calling Form 3565,parsExpectingType,"Expecting type" featureInformationalObjInferenceDiagnostic,"Diagnostic 3559 (warn when obj inferred) at informational level, off by default" 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." +3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration." diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 13c9dd9295..3d96ddb4e1 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1132,6 +1132,11 @@ Syntaxe expr1[expr2] je teď vyhrazena pro indexování a je při použití jako argument nejednoznačná. Více informací: https://aka.ms/fsharp-index-notation. Pokud voláte funkci s vícenásobnými curryfikovanými argumenty, přidejte mezi ně mezeru, třeba someFunction expr1 [expr2]. + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. Syntaxe (expr1)[expr2] je při použití jako argument nejednoznačná. Více informací: https://aka.ms/fsharp-index-notation. Pokud plánujete indexování nebo vytváření řezů, musíte použít (expr1).[expr2] na pozici argumentu. Pokud voláte funkci s vícenásobnými curryfikovanými argumenty, přidejte mezi ně mezeru, třeba someFunction (expr1) [expr2]. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 743c472a65..326fe56861 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1132,6 +1132,11 @@ Die Syntax "expr1[expr2]" ist jetzt für die Indizierung reserviert und mehrdeutig, wenn sie als Argument verwendet wird. Siehe https://aka.ms/fsharp-index-notation. Wenn Sie eine Funktion mit mehreren geschweiften Argumenten aufrufen, fügen Sie ein Leerzeichen dazwischen hinzu, z. B. "someFunction expr1 [expr2]". + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. Die Syntax "(expr1)[expr2]" ist mehrdeutig, wenn sie als Argument verwendet wird. Siehe https://aka.ms/fsharp-index-notation. Wenn Sie indizieren oder aufteilen möchten, müssen Sie "(expr1).[expr2]' in Argumentposition verwenden. Wenn Sie eine Funktion mit mehreren geschweiften Argumenten aufrufen, fügen Sie ein Leerzeichen dazwischen hinzu, z. B. "someFunction (expr1) [expr2]". diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index d61df64ef3..8a0438ebdc 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1132,6 +1132,11 @@ La sintaxis "expr1[expr2]" está reservada ahora para la indexación y es ambigua cuando se usa como argumento. Vea https://aka.ms/fsharp-index-notation. Si se llama a una función con varios argumentos currificados, agregue un espacio entre ellos, por ejemplo, "unaFunción expr1 [expr2]". + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. La sintaxis "(expr1)[expr2]" es ambigua cuando se usa como argumento. Vea https://aka.ms/fsharp-index-notation. Si piensa indexar o segmentar, debe usar "(expr1).[expr2]" en la posición del argumento. Si se llama a una función con varios argumentos currificados, se agregará un espacio entre ellos, por ejemplo, "unaFunción (expr1) [expr2]". diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index d576058a3e..a743344048 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1132,6 +1132,11 @@ La syntaxe « expr1[expr2] » est désormais réservée à l’indexation et est ambiguë lorsqu’elle est utilisée comme argument. Voir https://aka.ms/fsharp-index-notation. Si vous appelez une fonction avec plusieurs arguments codés, ajoutez un espace entre eux, par exemple « someFunction expr1 [expr2] ». + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. La syntaxe « (expr1)[expr2] » est ambiguë lorsqu’elle est utilisée comme argument. Voir https://aka.ms/fsharp-index-notation. Si vous avez l’intention d’indexer ou de découper, vous devez utiliser « (expr1).[expr2] » en position d’argument. Si vous appelez une fonction avec plusieurs arguments codés, ajoutez un espace entre eux, par exemple « someFunction (expr1) [expr2] ». diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 67ddd7e0fd..981903f672 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1132,6 +1132,11 @@ La sintassi 'expr1[expr2]' è ora riservata per l'indicizzazione ed è ambigua quando usata come argomento. Vedere https://aka.ms/fsharp-index-notation. Se si chiama una funzione con più argomenti sottoposti a corsi, aggiungere uno spazio tra di essi, ad esempio 'someFunction expr1 [expr2]'. + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. La sintassi '(expr1)[expr2]' è ambigua se usata come argomento. Vedere https://aka.ms/fsharp-index-notation. Se si intende eseguire l'indicizzazione o il sezionamento, è necessario usare '(expr1).[expr2]' nella posizione dell'argomento. Se si chiama una funzione con più argomenti sottoposti a corsi, aggiungere uno spazio tra di essi, ad esempio 'someFunction (expr1) [expr2]'. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 3f8ad74f8a..b37bfd8616 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1132,6 +1132,11 @@ 構文 'expr1[expr2]' は引数として使用されている場合、あいまいです。https://aka.ms/fsharp-index-notation を参照してください。複数のカリー化された引数を持つ関数を呼び出す場合には、'someFunction expr1 [expr2]' のように間にスペースを追加します。 + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. 構文 '(expr1)[expr2]' は引数として使用されている場合、あいまいです。https://aka.ms/fsharp-index-notation を参照してください。インデックス作成またはスライスを行う場合は、'(expr1).[expr2]' を引数の位置に使用する必要があります。複数のカリー化された引数を持つ関数を呼び出す場合は、'someFunction (expr1) [expr2]' のように間にスペースを追加します。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 6a17a61364..f2470a4651 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1132,6 +1132,11 @@ 구문 'expr1[expr2]'은 이제 인덱싱용으로 예약되어 있으며 인수로 사용될 때 모호합니다. https://aka.ms/fsharp-index-notation을 참조하세요. 여러 개의 커리된 인수로 함수를 호출하는 경우 그 사이에 공백을 추가하세요(예: 'someFunction expr1 [expr2]'). + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. '(expr1)[expr2]' 구문은 인수로 사용될 때 모호합니다. https://aka.ms/fsharp-index-notation을 참조하세요. 인덱싱이나 슬라이싱을 하려면 인수 위치에 '(expr1).[expr2]'를 사용해야 합니다. 여러 개의 커리된 인수로 함수를 호출하는 경우 그 사이에 공백을 추가하세요(예: 'someFunction (expr1) [expr2]'). diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index dd3877c8a4..bf5c18bae8 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1132,6 +1132,11 @@ Składnia wyrażenia „expr1[expr2]” jest teraz zarezerwowana do indeksowania i jest niejednoznaczna, gdy jest używana jako argument. Zobacz: https://aka.ms/fsharp-index-notation. Jeśli wywołujesz funkcję z wieloma argumentami typu curried, dodaj spację między nimi, np. „someFunction expr1 [expr2]”. + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. Składnia wyrażenia „(expr1)[expr2]” jest niejednoznaczna, gdy jest używana jako argument. Zobacz https://aka.ms/fsharp-index-notation. Jeśli zamierzasz indeksować lub fragmentować, to w pozycji argumentu musi być użyte wyrażenie „(expr1).[expr2]”. Jeśli wywołujesz funkcję z wieloma argumentami typu curried, dodaj spację między nimi, np. „someFunction (expr1) [expr2]”. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index a282f140ab..3b0db2265e 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1132,6 +1132,11 @@ A sintaxe 'expr1[expr2]' agora está reservada para indexação e é ambígua quando usada como um argumento. Consulte https://aka.ms/fsharp-index-notation. Se chamar uma função com vários argumentos na forma curried, adicione um espaço entre eles, por exemplo, 'someFunction expr1 [expr2]'. + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. A sintaxe '[expr1][expr2]' é ambígua quando usada como um argumento. Consulte https://aka.ms/fsharp-index-notation. Se você pretende indexar ou colocar em fatias, deve usar '(expr1).[expr2]' na posição do argumento. Se chamar uma função com vários argumentos na forma curried, adicione um espaço entre eles, por exemplo, 'someFunction [expr1] [expr2]'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 426b61eaeb..9af889b364 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1132,6 +1132,11 @@ Синтаксис "expr1[expr2]" теперь зарезервирован для индексирования и неоднозначен при использовании в качестве аргумента. См. https://aka.ms/fsharp-index-notation. При вызове функции с несколькими каррированными аргументами добавьте между ними пробел, например "someFunction expr1 [expr2]". + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. Синтаксис "(expr1)[expr2]" неоднозначен при использовании в качестве аргумента. См. https://aka.ms/fsharp-index-notation. Если вы намереваетесь индексировать или разрезать, необходимо использовать "(expr1).[expr2]" в позиции аргумента. При вызове функции с несколькими каррированными аргументами добавьте пробел между ними, например "someFunction (expr1) [expr2]". diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 67e127a905..a9c2df6043 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1132,6 +1132,11 @@ Söz dizimi “expr1[expr2]” artık dizin oluşturma için ayrılmıştır ve bağımsız değişken olarak kullanıldığında belirsizdir. https://aka.ms/fsharp-index-notation'a bakın. Birden çok curry bağımsız değişkenli bir işlev çağırıyorsanız, aralarına bir boşluk ekleyin, örn. “someFunction expr1 [expr2]”. + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. Söz dizimi “(expr1)[expr2]” bağımsız değişken olarak kullanıldığında belirsizdir. https://aka.ms/fsharp-index-notation'a bakın. Dizin oluşturmayı veya dilimlemeyi düşünüyorsanız, bağımsız değişken konumunda “(expr1).[expr2]” kullanmalısınız. Birden çok curry bağımsız değişkenli bir işlev çağırıyorsanız, aralarına bir boşluk ekleyin, örn. “someFunction (expr1) [expr2]”. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 7660508a93..7aaaa2ca48 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1132,6 +1132,11 @@ 语法“expr1[expr2]”现在保留用于索引,用作参数时不明确。请参见 https://aka.ms/fsharp-index-notation。如果使用多个扩充参数调用函数, 请在它们之间添加空格,例如“someFunction expr1 [expr2]”。 + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. 语法“(expr1)[expr2]”用作参数时不明确。请参阅 https://aka.ms/fsharp-index-notation。如果要索引或切片,则必须在参数位置使用“(expr1)[expr2]”。如果使用多个扩充参数调用函数,请在它们之间添加空格,例如“someFunction (expr1)[expr2]”。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 3a1c92ff8f..0819907496 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1132,6 +1132,11 @@ 語法 'expr1[expr2]' 現已為編製索引保留,但用作引數時不明確。請參閱 https://aka.ms/fsharp-index-notation。如果要呼叫具有多個調用引數的函式,請在它們之間新增空格,例如 'someFunction expr1 [expr2]'。 + + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + + The syntax '(expr1)[expr2]' is ambiguous when used as an argument. See https://aka.ms/fsharp-index-notation. If you intend indexing or slicing then you must use '(expr1).[expr2]' in argument position. If calling a function with multiple curried arguments, add a space between them, e.g. 'someFunction (expr1) [expr2]'. 語法 '(expr1)[expr2]' 用作引數時不明確。請參閱 https://aka.ms/fsharp-index-notation。如果您要編製索引或切割,則必須在引數位置使用 '(expr1).[expr2]'。如果要呼叫具有多個調用引數的函式,請在它們之間新增空格,例如 'someFunction (expr1) [expr2]'。 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs index 1b113c3d5c..24a92789b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs @@ -151,4 +151,17 @@ type System.Random with |> withSingleDiagnostic (Error 909, Line 3, Col 15, Line 3, Col 33, """All implemented interfaces should be declared on the initial declaration of the type""") - \ No newline at end of file + [] + let ``Interface member with tuple argument should give error message with better solution``() = + FSharp """ +type IFoo = + abstract member Bar: (int * int) -> int + +type Foo = + interface IFoo with + member _.Bar (x, y) = x + y +""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 3577, Line 7, Col 14, Line 7, Col 17, + """This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration.""") From d4d17c660aab3a575ed12d1a5020b2ef272e3695 Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Sun, 4 Jun 2023 18:07:16 +0100 Subject: [PATCH 2/6] grammar --- src/Compiler/FSComp.txt | 2 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.de.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.es.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.fr.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.it.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ja.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ko.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.pl.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ru.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.tr.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 4 ++-- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 91f89da7f7..54ec638528 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1696,4 +1696,4 @@ featureEscapeBracesInFormattableString,"Escapes curly braces before calling Form 3565,parsExpectingType,"Expecting type" featureInformationalObjInferenceDiagnostic,"Diagnostic 3559 (warn when obj inferred) at informational level, off by default" 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." -3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration." +3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration." diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 3d96ddb4e1..9b31321e09 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 326fe56861..212ebf68ba 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 8a0438ebdc..603640e29e 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index a743344048..cc880e4033 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 981903f672..41562b3de2 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index b37bfd8616..abc7702664 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index f2470a4651..2d1964dddd 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index bf5c18bae8..a734143f81 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 3b0db2265e..4d51afe89b 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 9af889b364..3c48950c8e 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index a9c2df6043..bc377801f3 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 7aaaa2ca48..8b1d8caddc 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 0819907496..b85891779a 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. From a34326db1bfd4b3ad5eb78abdd597dc1e4c3f3b7 Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Sun, 4 Jun 2023 19:00:40 +0100 Subject: [PATCH 3/6] wip --- src/Compiler/Checking/CheckExpressions.fs | 6 ++++-- .../InterfaceImplInAugmentationsTests.fs | 15 --------------- .../ErrorMessages/TypeMismatchTests.fs | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index db1d3cf17f..f7ca4a1fdd 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -11106,8 +11106,10 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a // https://github.com/dotnet/fsharp/issues/15307 // check if abstract method expects tuple, give better error message | TType_fun(_,TType_fun(TType_tuple _,_,_),_) -> - errorR(Error(FSComp.SR.tcOverrideUsesMultipleArgumentsInsteadOfTuple(), memberId.idRange)) - [] + if not slot.NumArgs.IsEmpty && slot.NumArgs.Head = 1 then + errorR(Error(FSComp.SR.tcOverrideUsesMultipleArgumentsInsteadOfTuple(), memberId.idRange)) + [] + else raiseGenericArityMismatch() | _ -> raiseGenericArityMismatch() | _ -> raiseGenericArityMismatch() | _ -> [] // check that method to override is sealed is located at CheckOverridesAreAllUsedOnce (typrelns.fs) diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs index 24a92789b9..a92df0e2aa 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs @@ -150,18 +150,3 @@ type System.Random with |> shouldFail |> withSingleDiagnostic (Error 909, Line 3, Col 15, Line 3, Col 33, """All implemented interfaces should be declared on the initial declaration of the type""") - - [] - let ``Interface member with tuple argument should give error message with better solution``() = - FSharp """ -type IFoo = - abstract member Bar: (int * int) -> int - -type Foo = - interface IFoo with - member _.Bar (x, y) = x + y -""" - |> typecheck - |> shouldFail - |> withSingleDiagnostic (Error 3577, Line 7, Col 14, Line 7, Col 17, - """This override takes a tuple instead of multiple arguments. Try to add additional layer of parentheses at the call site, or remove parentheses at abstract method declaration.""") diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs index afd228cb5f..2c661da7f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs @@ -293,3 +293,18 @@ type Derived3() = (Error 856, Line 8, Col 16, Line 8, Col 22, "This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:" + System.Environment.NewLine + " abstract Base.Member: int * string -> string") (Error 856, Line 12, Col 16, Line 12, Col 22, "This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:" + System.Environment.NewLine + " abstract Base.Member: int * string -> string") (Error 1, Line 16, Col 24, Line 16, Col 34, "This expression was expected to have type\n 'int' \nbut here has type\n 'string' ")] + + [] + let ``Interface member with tuple argument should give error message with better solution``() = + FSharp """ +type IFoo = + abstract member Bar: (int * int) -> int + +type Foo = + interface IFoo with + member _.Bar (x, y) = x + y +""" + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 3577, Line 7, Col 14, Line 7, Col 17, + """This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration.""") From 8610f720cd59d8d4a351e16df01c25ed4b39c437 Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Sun, 4 Jun 2023 19:02:05 +0100 Subject: [PATCH 4/6] fix --- .../ErrorMessages/InterfaceImplInAugmentationsTests.fs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs index a92df0e2aa..1b113c3d5c 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs @@ -150,3 +150,5 @@ type System.Random with |> shouldFail |> withSingleDiagnostic (Error 909, Line 3, Col 15, Line 3, Col 33, """All implemented interfaces should be declared on the initial declaration of the type""") + + \ No newline at end of file From c680bd250cc362ce4244dbe8c45fc22abf9c22d2 Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Tue, 13 Jun 2023 17:08:21 +0100 Subject: [PATCH 5/6] review --- src/Compiler/FSComp.txt | 2 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.de.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.es.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.fr.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.it.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ja.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ko.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.pl.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.ru.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.tr.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 4 ++-- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 4 ++-- .../ErrorMessages/TypeMismatchTests.fs | 2 +- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 54ec638528..d2807b8e3f 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1696,4 +1696,4 @@ featureEscapeBracesInFormattableString,"Escapes curly braces before calling Form 3565,parsExpectingType,"Expecting type" featureInformationalObjInferenceDiagnostic,"Diagnostic 3559 (warn when obj inferred) at informational level, off by default" 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." -3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration." +3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c')." diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 9b31321e09..56c1149b3c 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 212ebf68ba..547e1bae97 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 603640e29e..5ebb31a8e0 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index cc880e4033..a45ed15a10 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 41562b3de2..c7076cd942 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index abc7702664..0abbfca465 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 2d1964dddd..632dbd9792 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index a734143f81..a6248b1dd6 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 4d51afe89b..385766e4fc 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 3c48950c8e..e84a5f7798 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index bc377801f3..f71f0cf9b0 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 8b1d8caddc..774f795549 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index b85891779a..cc8e4082a8 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1133,8 +1133,8 @@ - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. - This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration. + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). + This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c'). diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs index 2c661da7f7..d5fb84f460 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs @@ -307,4 +307,4 @@ type Foo = |> typecheck |> shouldFail |> withSingleDiagnostic (Error 3577, Line 7, Col 14, Line 7, Col 17, - """This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the call site, or remove parentheses at the abstract method declaration.""") + """This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c').""") From 6ba5d89bb75cf9f521714e309b3bc476ea8fcc5a Mon Sep 17 00:00:00 2001 From: 0101 <0101@innit.cz> Date: Fri, 23 Jun 2023 16:18:54 +0200 Subject: [PATCH 6/6] fix whitespace --- src/Compiler/FSComp.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 1d0e3bb9ef..764f3faf17 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1699,5 +1699,4 @@ featureInformationalObjInferenceDiagnostic,"Diagnostic 3559 (warn when obj infer 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'" -3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c')." - +3577,tcOverrideUsesMultipleArgumentsInsteadOfTuple,"This override takes a tuple instead of multiple arguments. Try to add an additional layer of parentheses at the method definition (e.g. 'member _.Foo((x, y))'), or remove parentheses at the abstract method declaration (e.g. 'abstract member Foo: 'a * 'b -> 'c')." \ No newline at end of file