提交 1cc0cacc 编写于 作者: S Steffen Forkmann

Report the concrete type in error msg

上级 2389a27a
......@@ -259,17 +259,17 @@ chkVariableUsedInInvalidWay,"The variable '%s' is used in an invalid way"
433,chkEntryPointUsage,"A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence."
chkUnionCaseCompiledForm,"compiled form of the union case"
chkUnionCaseDefaultAugmentation,"default augmentation of the union case"
434,chkPropertySameNameMethod,"Name clash. The property '%s' has the same name as a method in this type."
435,chkGetterSetterDoNotMatchAbstract,"The property '%s' has a getter and a setter that do not match. If one is abstract then the other must be as well."
436,chkPropertySameNameIndexer,"The property '%s' has the same name as another property in this type, but one takes indexer arguments and the other does not. You may be missing an indexer argument to one of your properties."
434,chkPropertySameNameMethod,"The property '%s' has the same name as a method in type '%s'."
435,chkGetterSetterDoNotMatchAbstract,"The property '%s' of type '%s' has a getter and a setter that do not match. If one is abstract then the other must be as well."
436,chkPropertySameNameIndexer,"The property '%s' has the same name as another property in type '%s', but one takes indexer arguments and the other does not. You may be missing an indexer argument to one of your properties."
437,chkCantStoreByrefValue,"A type would store a byref typed value. This is not permitted by Common IL."
#See related 1205 chkDuplicateInherittedVirtualMethod
438,chkDuplicateMethod,"Duplicate method. The method '%s' has the same name and signature as another method in this type."
438,chkDuplicateMethodWithSuffix,"Duplicate method. The method '%s' has the same name and signature as another method in this type once tuples, functions, units of measure and/or provided types are erased."
439,chkDuplicateMethodCurried,"The method '%s' has curried arguments but has the same name as another method in this type. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments."
438,chkDuplicateMethod,"Duplicate method. The method '%s' has the same name and signature as another method in type '%s'."
438,chkDuplicateMethodWithSuffix,"Duplicate method. The method '%s' has the same name and signature as another method in type '%s' once tuples, functions, units of measure and/or provided types are erased."
439,chkDuplicateMethodCurried,"The method '%s' has curried arguments but has the same name as another method in type '%s'. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments."
440,chkCurriedMethodsCantHaveOutParams,"Methods with curried arguments cannot declare 'out', 'ParamArray', 'optional', 'ReflectedDefinition', 'byref', 'CallerLineNumber', 'CallerMemberName', or 'CallerFilePath' arguments"
441,chkDuplicateProperty,"Duplicate property. The property '%s' has the same name and signature as another property in this type."
441,chkDuplicatePropertyWithSuffix,"Duplicate property. The property '%s' has the same name and signature as another property in this type once tuples, functions, units of measure and/or provided types are erased."
441,chkDuplicateProperty,"Duplicate property. The property '%s' has the same name and signature as another property in type '%s'."
441,chkDuplicatePropertyWithSuffix,"Duplicate property. The property '%s' has the same name and signature as another property in type '%s' once tuples, functions, units of measure and/or provided types are erased."
442,chkDuplicateMethodInheritedType,"Duplicate method. The abstract method '%s' has the same name and signature as an abstract method in an inherited type."
442,chkDuplicateMethodInheritedTypeWithSuffix,"Duplicate method. The abstract method '%s' has the same name and signature as an abstract method in an inherited type once tuples, functions, units of measure and/or provided types are erased."
443,chkMultipleGenericInterfaceInstantiations,"This type implements the same interface at different generic instantiations '%s' and '%s'. This is not permitted in this version of F#."
......
......@@ -1453,14 +1453,14 @@ let CheckEntityDefn cenv env (tycon:Entity) =
if others |> List.exists (checkForDup EraseAll) then
if others |> List.exists (checkForDup EraseNone) then
errorR(Error(FSComp.SR.chkDuplicateMethod(nm),m))
errorR(Error(FSComp.SR.chkDuplicateMethod(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
else
errorR(Error(FSComp.SR.chkDuplicateMethodWithSuffix(nm),m))
errorR(Error(FSComp.SR.chkDuplicateMethodWithSuffix(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
let numCurriedArgSets = minfo.NumArgs.Length
if numCurriedArgSets > 1 && others |> List.exists (fun minfo2 -> not (IsAbstractDefaultPair2 minfo minfo2)) then
errorR(Error(FSComp.SR.chkDuplicateMethodCurried nm,m))
errorR(Error(FSComp.SR.chkDuplicateMethodCurried(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
if numCurriedArgSets > 1 &&
(minfo.GetParamDatas(cenv.amap, m, minfo.FormalMethodInst)
......@@ -1495,15 +1495,18 @@ let CheckEntityDefn cenv env (tycon:Entity) =
for pinfo in immediateProps do
let nm = pinfo.PropertyName
let m = (match pinfo.ArbitraryValRef with None -> m | Some vref -> vref.DefinitionRange)
if hashOfImmediateMeths.ContainsKey(nm) then
errorR(Error(FSComp.SR.chkPropertySameNameMethod(nm),m))
let others = getHash hashOfImmediateProps nm
let m =
match pinfo.ArbitraryValRef with
| None -> m
| Some vref -> vref.DefinitionRange
if hashOfImmediateMeths.ContainsKey nm then
errorR(Error(FSComp.SR.chkPropertySameNameMethod(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
if pinfo.HasGetter && pinfo.HasSetter then
let others = getHash hashOfImmediateProps nm
if (pinfo.GetterMethod.IsVirtual <> pinfo.SetterMethod.IsVirtual) then
errorR(Error(FSComp.SR.chkGetterSetterDoNotMatchAbstract(nm),m))
if pinfo.HasGetter && pinfo.HasSetter && pinfo.GetterMethod.IsVirtual <> pinfo.SetterMethod.IsVirtual then
errorR(Error(FSComp.SR.chkGetterSetterDoNotMatchAbstract(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
let checkForDup erasureFlag pinfo2 =
// abstract/default pairs of duplicate properties are OK
......@@ -1515,9 +1518,9 @@ let CheckEntityDefn cenv env (tycon:Entity) =
if others |> List.exists (checkForDup EraseAll) then
if others |> List.exists (checkForDup EraseNone) then
errorR(Error(FSComp.SR.chkDuplicateProperty(nm) ,m))
errorR(Error(FSComp.SR.chkDuplicateProperty(nm, NicePrint.minimalStringOfType cenv.denv typ) ,m))
else
errorR(Error(FSComp.SR.chkDuplicatePropertyWithSuffix(nm) ,m))
errorR(Error(FSComp.SR.chkDuplicatePropertyWithSuffix(nm, NicePrint.minimalStringOfType cenv.denv typ) ,m))
// Check to see if one is an indexer and one is not
if ( (pinfo.HasGetter &&
......@@ -1529,7 +1532,7 @@ let CheckEntityDefn cenv env (tycon:Entity) =
(let nargs = pinfo.GetParamTypes(cenv.amap,m).Length
others |> List.exists (fun pinfo2 -> (isNil(pinfo2.GetParamTypes(cenv.amap,m))) <> (nargs = 0)))) then
errorR(Error(FSComp.SR.chkPropertySameNameIndexer(nm),m))
errorR(Error(FSComp.SR.chkPropertySameNameIndexer(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
// Check to see if the signatures of the both getter and the setter imply the same property type
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册