提交 c46ca4e3 编写于 作者: G Gustavo Leon 提交者: Kevin Ransom (msft)

Remove ambiguous resolution error FS0332 (#4170)

上级 86c023b2
......@@ -161,7 +161,6 @@ FieldNotContainedMutablesDiffer,"The module contains the field\n %s \nbut
FieldNotContainedLiteralsDiffer,"The module contains the field\n %s \nbut its signature specifies\n %s \nThe 'literal' modifiers differ"
FieldNotContainedTypesDiffer,"The module contains the field\n %s \nbut its signature specifies\n %s \nThe types differ"
331,typrelCannotResolveImplicitGenericInstantiation,"The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. '%s' and '%s'. Consider using type annotations to resolve the ambiguity"
332,typrelCannotResolveAmbiguityInOverloadedOperator,"Could not resolve the ambiguity inherent in the use of the operator '%s' at or near this program point. Consider using type annotations to resolve the ambiguity."
333,typrelCannotResolveAmbiguityInPrintf,"Could not resolve the ambiguity inherent in the use of a 'printf'-style format string"
334,typrelCannotResolveAmbiguityInEnum,"Could not resolve the ambiguity in the use of a generic construct with an 'enum' constraint at or near this position"
335,typrelCannotResolveAmbiguityInDelegate,"Could not resolve the ambiguity in the use of a generic construct with a 'delegate' constraint at or near this position"
......
......@@ -141,8 +141,7 @@ let ChooseTyparSolutionAndRange (g: TcGlobals) amap (tp:Typar) =
match tpc with
| TyparConstraint.CoercesTo(x,m) ->
join m x,m
| TyparConstraint.MayResolveMember(TTrait(_,nm,_,_,_,_),m) ->
errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInOverloadedOperator(DemangleOperatorName nm),m))
| TyparConstraint.MayResolveMember(TTrait(_,_,_,_,_,_),m) ->
maxSoFar,m
| TyparConstraint.SimpleChoice(_,m) ->
errorR(Error(FSComp.SR.typrelCannotResolveAmbiguityInPrintf(),m))
......
......@@ -802,11 +802,6 @@
<target state="translated">Nepovedlo se přeložit implicitní vytvoření instance obecného konstruktoru na této pozici nebo blízko ní, protože by se dala přeložit na víc nesouvisejících typů, třeba {0} a {1}. Tuto nejednoznačnost můžete vyřešit pomocí poznámek typu.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Nepovedlo se vyřešit nejednoznačnost vyplývající z použití operátoru {0} na tomto místě v programu nebo blízko něho. Tuto nejednoznačnost můžete vyřešit pomocí poznámek typu.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Nepovedlo se vyřešit nejednoznačnost vyplývající z použití formátovacího řetězce ve stylu printf.</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">Die implizite Instanziierung eines generischen Konstrukts an diesem Punkt oder in dessen Umgebung konnte nicht aufgelöst werden, weil sie zu mehreren unzusammenhängenden Typen aufgelöst werden könnte, z.B. "{0}" und "{1}". Verwenden Sie Typanmerkungen, um die Mehrdeutigkeit aufzulösen.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Die inhärente Mehrdeutigkeit bei der Verwendung des {0}-Operators an diesem Programmpunkt oder in dessen Umgebung konnte nicht aufgelöst werden. Verwenden Sie Typanmerkungen, um die Mehrdeutigkeit aufzulösen.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Die inhärente Mehrdeutigkeit bei der Verwendung einer printf-Formatzeichenfolge konnte nicht aufgelöst werden.</target>
......
......@@ -802,11 +802,6 @@
<target state="new">The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. '{0}' and '{1}'. Consider using type annotations to resolve the ambiguity</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="new">Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="new">Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">No se pudo resolver la creación de instancia implícita de una construcción genérica en este punto o cerca de él porque se podía resolver en varios tipos no relacionados; por ejemplo, '{0}' y '{1}'. Considere el uso de anotaciones de tipo para resolver la ambigüedad.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">No se pudo resolver la ambigüedad inherente en el uso del operador '{0}' en este punto del programa o cerca de él. Considere el uso de anotaciones de tipo para resolver la ambigüedad.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">No se pudo resolver la ambigüedad inherente en el uso de una cadena de formato de tipo 'printf'.</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">Impossible de résoudre l'instanciation implicite d'une construction générique à cet emplacement ou à proximité, car elle peut être résolue en plusieurs types non liés, par exemple '{0}' et '{1}'. Utilisez des annotations de type pour résoudre l'ambigüité</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Impossible de résoudre l'ambigüité inhérente à l'utilisation de l'opérateur '{0}' à cet emplacement du programme ou à proximité. Utilisez des annotations de type pour résoudre l'ambigüité.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Impossible de résoudre l'ambigüité inhérente à l'utilisation d'une chaîne de format de style 'printf'</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">Non è stato possibile risolvere la creazione di istanza implicita di un costrutto generico in questo punto o in prossimità di esso perché la risoluzione potrebbe restituire più tipi non correlati, ad esempio '{0}' e '{1}'. Provare a usare annotazioni di tipo per risolvere l'ambiguità</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Non è stato possibile risolvere l'ambiguità relativa all'uso dell'operatore '{0}' in questo punto del programma o in prossimità di esso. Provare invece a risolvere l'ambiguità usando annotazioni di tipo.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Non è stato possibile risolvere l'ambiguità relativa all'uso della stringa di formato di stile 'printf'</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">この場所またはその付近にあるジェネリック コンストラクトの暗黙的なインスタンス化を解決できませんでした。これは、関連性のない複数の型に解決される可能性があるためです (たとえば、'{0}' と '{1}')。あいまいさを解決するために、型の注釈を使用してください。</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">このプログラム ポイント、またはその付近にある演算子 '{0}' の使用に関して、あいまいな継承を解決できませんでした。あいまいさを解決するために、型の注釈を使用してください。</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">'printf' 形式の書式指定文字列の使用に関して、あいまいな継承を解決できませんでした</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">관련되지 않은 여러 형식(예: '{0}'과(와) '{1}')으로 확인될 수 있으므로 이 지점 또는 이 지점 근처에서 제네릭 구문의 암시적 인스턴스를 확인할 수 없습니다. 형식 주석을 사용하여 모호성을 해결하세요.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">’{0}' 연산자 사용과 관련하여 이 프로그램 지점 또는 이 지점 근처에서 본질적으로 발생하는 모호성을 해결할 수 없습니다. 형식 주석을 사용하여 모호성을 해결하세요.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">'printf' 스타일의 서식 문자열 사용과 관련하여 본질적으로 발생하는 모호성을 해결할 수 없습니다.</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">Nie można rozpoznać niejawnego wystąpienia konstrukcji ogólnej w tym miejscu lub w jego pobliżu, ponieważ może to spowodować powstanie wielu niepowiązanych typów, na przykład „{0}” i „{1}”. Rozważ użycie adnotacji typu w celu rozwiązania niejednoznaczności</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Nie można rozwiązać odziedziczonej niejednoznaczności w przypadku użycia operatora „{0}” w tym punkcie programu lub w jego pobliżu. Rozważ użycie adnotacji typu w celu rozwiązania niejednoznaczności.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Nie można usunąć niejednoznaczności spowodowanej użyciem ciągu formatu „printf”</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">A instanciação implícita do constructo genérico neste ponto ou próximo a ele não pode ser resolvida porque ele conseguiu resolver tipos não relacionados múltiplos, por exemplo '{0}' e '{1}'. Considere usar anotações de tipo para resolver a ambiguidade</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Não foi possível resolver a ambiguidade no uso de um operador '{0}' neste ponto do programa ou próximo a ele. Considere usar anotações de tipo para resolver a ambiguidade.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Não foi possível resolver a ambiguidade inerente ao uso de uma cadeia de caracteres com formato de estilo 'printf'</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">Неявное создание экземпляров базовой конструкции в данной точке или рядом с ней не может быть разрешено, так как тогда возможно разрешение в несколько несвязанных типов, напр. "{0}" и "{1}". Рекомендуется использовать аннотации типа для решения неоднозначности</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">Не удалось разрешить неоднозначность, унаследованную в использовании оператора "{0}" в данной точке программы или рядом с ней. Рекомендуется использовать аннотации типа для решения неоднозначности.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">Не удалось разрешить неоднозначность, унаследованную в использовании строки формата вида "printf"</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">Genel yapının bu konumda veya yakınında örtük olarak örneklenmesi çözümlenemedi, çünkü ilişkisiz birden çok türe çözümlenebiliyordu, örn. '{0}' ve '{1}'. Belirsizliği çözümlemek için tür ek açıklamaları kullanmayı düşünün</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">'{0}' işlecinin bu program noktasında veya yakınında kullanılmasında bulunan belirsizlik çözümlenemedi. Bu belirsizliği çözmek için tür ek açıklamaları kullanmayı düşünün.</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">'printf' stilindeki biçim dizesinin kullanılmasına bulunan belirsizlik çözümlenemedi.</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">未能解析在此点或其附近进行的泛型构造的隐式实例化,因为它可以解析为多个不相关的类型,例如“{0}”和“{1}”。请考虑使用类型批注来解析此多义性</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">未能解析在此程序点或其附近使用运算符“{0}”所产生的固有多义性。请考虑使用类型批注来解析此多义性。</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">未能解析使用“printf”样式的格式字符串所产生的固有多义性</target>
......
......@@ -802,11 +802,6 @@
<target state="translated">無法解決在這個點或附近的泛型建構的隱含具現化,因為它可能解析成多個不相關的類型,例如 '{0}' 和 '{1}'。請考慮使用類型註釋來解決模稜兩可</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInOverloadedOperator">
<source>Could not resolve the ambiguity inherent in the use of the operator '{0}' at or near this program point. Consider using type annotations to resolve the ambiguity.</source>
<target state="translated">無法解決在這個程式點或附近使用運算子 '{0}' 時固有的模稜兩可。請考慮使用型別註解來解決模稜兩可。</target>
<note />
</trans-unit>
<trans-unit id="typrelCannotResolveAmbiguityInPrintf">
<source>Could not resolve the ambiguity inherent in the use of a 'printf'-style format string</source>
<target state="translated">無法解決使用 'printf' 樣式的格式字串時固有的模稜兩可</target>
......
......@@ -1791,6 +1791,44 @@ module SRTPFix =
printfn "%A" <| replace 'q' (test("HI"))
*)
module SRTPFixAmbiguity =
// Mini Repro from FSharpPlus https://github.com/gusty/FSharpPlus
type Id<'t>(v:'t) = member __.getValue = v
type Interface<'t> = abstract member getValue : 't
type Monad =
static member inline InvokeReturn (x:'T) : '``Monad<'T>`` =
let inline call (mthd : ^M, output : ^R) = ((^M or ^R) : (static member Return: _ -> _) output)
call (Unchecked.defaultof<Monad>, Unchecked.defaultof<'``Monad<'T>``>) x
static member Return (_:Interface<'a>) = fun (_:'a) -> Unchecked.defaultof<Interface<'a>> : Interface<'a>
static member Return (_:seq<'a> ) = fun x -> Seq.singleton x : seq<'a>
static member Return (_:option<'a> ) = fun x -> Some x : option<'a>
static member Return (_:Id<'a> ) = fun x -> Id x : Id<'a>
static member inline InvokeBind (source : '``Monad<'T>``) (binder : 'T -> '``Monad<'U>``) : '``Monad<'U>`` =
let inline call (mthd : 'M, input : 'I, _output : 'R, f) = ((^M or ^I or ^R) : (static member Bind: _*_ -> _) input, f)
call (Unchecked.defaultof<Monad>, source, Unchecked.defaultof<'``Monad<'U>``>, binder)
static member Bind (source : Interface<'T>, f : 'T -> Interface<'U>) = f source.getValue : Interface<'U>
static member Bind (source : seq<'T> , f : 'T -> seq<'U> ) = Seq.collect f source : seq<'U>
static member Bind (source : Id<'T> , f : 'T -> Id<'U> ) = f source.getValue : Id<'U>
static member Bind (source :option<'T> , f : 'T -> _ ) = Option.bind f source : option<'U>
let inline result (x:'T) = Monad.InvokeReturn x :'``Monad<'T>``
let inline (>>=) (x:'``Monad<'T>``) (f:'T->'``Monad<'U>``) = Monad.InvokeBind x f :'``Monad<'U>``
type ReaderT<'R,'``monad<'T>``> = ReaderT of ('R -> '``monad<'T>``)
let runReaderT (ReaderT x) = x : 'R -> '``Monad<'T>``
type ReaderT<'R,'``monad<'T>``> with
static member inline Return _ = fun (x : 'T) -> ReaderT (fun _ -> result x) : ReaderT<'R, '``Monad<'T>``>
static member inline Bind (ReaderT (m:_->'``Monad<'T>``), f:'T->_) = ReaderT (fun r -> m r >>= (fun a -> runReaderT (f a) r)) : ReaderT<'R, '``Monad<'U>``>
let test1 : ReaderT<string, option<_>> = ReaderT result >>= result
let test2 : ReaderT<string, Id<_>> = ReaderT result >>= result
let test3 : ReaderT<string, seq<_>> = ReaderT result >>= result
// See https://github.com/Microsoft/visualfsharp/issues/4040
module InferenceRegression4040 =
type Foo() =
......
// #Regression #Conformance #ObjectOrientedTypes #Classes #LetBindings
// Scoping:
// identifier introduced by let is local
//<Expects status="error" span="(12,14-12,15)" id="FS0039">The value, namespace, type or module 'm' is not defined</Expects>
//<Expects status="error" span="(12,23-12,24)" id="FS0039">The value, namespace, type or module 'n' is not defined</Expects>
//<Expects status="notin" span="(12,21-12,22)" id="FS0332">Could not resolve the ambiguity inherent in the use of the operator '\( \+ \)' at or near this program point\. Consider using type annotations to resolve the ambiguity\.$</Expects>
//<Expects status="error" span="(11,14-11,15)" id="FS0039">The value, namespace, type or module 'm' is not defined</Expects>
//<Expects status="error" span="(11,23-11,24)" id="FS0039">The value, namespace, type or module 'n' is not defined</Expects>
type C() = class
static let mutable m = [1;2;3]
......
// #Conformance #TypeConstraints
//<Expects status="error" span="(5,5-5,52)" id="FS0332">Could not resolve the ambiguity inherent in the use of the operator 'someFunc' at or near this program point\. Consider using type annotations to resolve the ambiguity\.$</Expects>
//<Expects status="error" span="(5,5-5,52)" id="FS0071">Type constraint mismatch when applying the default type 'obj' for a type inference variable\. The type 'obj' does not support the operator 'someFunc' Consider adding further type constraints$</Expects>
//<Expects status="error" span="(4,5-4,52)" id="FS0071">Type constraint mismatch when applying the default type 'obj' for a type inference variable\. The type 'obj' does not support the operator 'someFunc' Consider adding further type constraints$</Expects>
let testFunc (a : ^x) =
(^x : (static member someFunc : unit -> ^x) ())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册