Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1cc0cac

Browse files
committed
Report the concrete type in error msg
1 parent2389a27 commit1cc0cac

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

‎src/fsharp/FSComp.txt‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,17 @@ chkVariableUsedInInvalidWay,"The variable '%s' is used in an invalid way"
259259
433,chkEntryPointUsage,"A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence."
260260
chkUnionCaseCompiledForm,"compiled form of the union case"
261261
chkUnionCaseDefaultAugmentation,"default augmentation of the union case"
262-
434,chkPropertySameNameMethod,"Name clash.The property '%s' has the same name as a method inthistype."
263-
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."
264-
436,chkPropertySameNameIndexer,"The property '%s' has the same name as another property inthistype, but one takes indexer arguments and the other does not. You may be missing an indexer argument to one of your properties."
262+
434,chkPropertySameNameMethod,"The property '%s' has the same name as a method in type '%s'."
263+
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."
264+
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."
265265
437,chkCantStoreByrefValue,"A type would store a byref typed value. This is not permitted by Common IL."
266266
#See related 1205 chkDuplicateInherittedVirtualMethod
267-
438,chkDuplicateMethod,"Duplicate method. The method '%s' has the same name and signature as another method inthistype."
268-
438,chkDuplicateMethodWithSuffix,"Duplicate method. The method '%s' has the same name and signature as another method inthistype once tuples, functions, units of measure and/or provided types are erased."
269-
439,chkDuplicateMethodCurried,"The method '%s' has curried arguments but has the same name as another method inthistype. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments."
267+
438,chkDuplicateMethod,"Duplicate method. The method '%s' has the same name and signature as another method in type '%s'."
268+
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."
269+
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."
270270
440,chkCurriedMethodsCantHaveOutParams,"Methods with curried arguments cannot declare 'out', 'ParamArray', 'optional', 'ReflectedDefinition', 'byref', 'CallerLineNumber', 'CallerMemberName', or 'CallerFilePath' arguments"
271-
441,chkDuplicateProperty,"Duplicate property. The property '%s' has the same name and signature as another property inthistype."
272-
441,chkDuplicatePropertyWithSuffix,"Duplicate property. The property '%s' has the same name and signature as another property inthistype once tuples, functions, units of measure and/or provided types are erased."
271+
441,chkDuplicateProperty,"Duplicate property. The property '%s' has the same name and signature as another property in type '%s'."
272+
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."
273273
442,chkDuplicateMethodInheritedType,"Duplicate method. The abstract method '%s' has the same name and signature as an abstract method in an inherited type."
274274
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."
275275
443,chkMultipleGenericInterfaceInstantiations,"This type implements the same interface at different generic instantiations '%s' and '%s'. This is not permitted in this version of F#."

‎src/fsharp/PostInferenceChecks.fs‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,14 +1453,14 @@ let CheckEntityDefn cenv env (tycon:Entity) =
14531453

14541454
if others|> List.exists(checkForDup EraseAll)then
14551455
if others|> List.exists(checkForDup EraseNone)then
1456-
errorR(Error(FSComp.SR.chkDuplicateMethod(nm),m))
1456+
errorR(Error(FSComp.SR.chkDuplicateMethod(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
14571457
else
1458-
errorR(Error(FSComp.SR.chkDuplicateMethodWithSuffix(nm),m))
1458+
errorR(Error(FSComp.SR.chkDuplicateMethodWithSuffix(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
14591459

14601460
letnumCurriedArgSets= minfo.NumArgs.Length
14611461

14621462
if numCurriedArgSets>1&& others|> List.exists(fun minfo2->not(IsAbstractDefaultPair2 minfo minfo2))then
1463-
errorR(Error(FSComp.SR.chkDuplicateMethodCurried nm,m))
1463+
errorR(Error(FSComp.SR.chkDuplicateMethodCurried(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
14641464

14651465
if numCurriedArgSets>1&&
14661466
(minfo.GetParamDatas(cenv.amap, m, minfo.FormalMethodInst)
@@ -1495,15 +1495,18 @@ let CheckEntityDefn cenv env (tycon:Entity) =
14951495

14961496
for pinfoin immediatePropsdo
14971497
letnm= pinfo.PropertyName
1498-
letm=(match pinfo.ArbitraryValRefwith None-> m| Some vref-> vref.DefinitionRange)
1499-
if hashOfImmediateMeths.ContainsKey(nm)then
1500-
errorR(Error(FSComp.SR.chkPropertySameNameMethod(nm),m))
1501-
letothers= getHash hashOfImmediateProps nm
1498+
letm=
1499+
match pinfo.ArbitraryValRefwith
1500+
| None-> m
1501+
| Some vref-> vref.DefinitionRange
1502+
1503+
if hashOfImmediateMeths.ContainsKey nmthen
1504+
errorR(Error(FSComp.SR.chkPropertySameNameMethod(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
15021505

1503-
if pinfo.HasGetter&& pinfo.HasSetterthen
1506+
letothers= getHash hashOfImmediateProps nm
15041507

1505-
if(pinfo.GetterMethod.IsVirtual<>pinfo.SetterMethod.IsVirtual)then
1506-
errorR(Error(FSComp.SR.chkGetterSetterDoNotMatchAbstract(nm),m))
1508+
if pinfo.HasGetter&& pinfo.HasSetter&&pinfo.GetterMethod.IsVirtual<> pinfo.SetterMethod.IsVirtualthen
1509+
errorR(Error(FSComp.SR.chkGetterSetterDoNotMatchAbstract(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
15071510

15081511
letcheckForDup erasureFlag pinfo2=
15091512
// abstract/default pairs of duplicate properties are OK
@@ -1515,9 +1518,9 @@ let CheckEntityDefn cenv env (tycon:Entity) =
15151518

15161519
if others|> List.exists(checkForDup EraseAll)then
15171520
if others|> List.exists(checkForDup EraseNone)then
1518-
errorR(Error(FSComp.SR.chkDuplicateProperty(nm),m))
1521+
errorR(Error(FSComp.SR.chkDuplicateProperty(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
15191522
else
1520-
errorR(Error(FSComp.SR.chkDuplicatePropertyWithSuffix(nm),m))
1523+
errorR(Error(FSComp.SR.chkDuplicatePropertyWithSuffix(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
15211524
// Check to see if one is an indexer and one is not
15221525

15231526
if((pinfo.HasGetter&&
@@ -1529,7 +1532,7 @@ let CheckEntityDefn cenv env (tycon:Entity) =
15291532
(letnargs= pinfo.GetParamTypes(cenv.amap,m).Length
15301533
others|> List.exists(fun pinfo2->(isNil(pinfo2.GetParamTypes(cenv.amap,m)))<>(nargs=0))))then
15311534

1532-
errorR(Error(FSComp.SR.chkPropertySameNameIndexer(nm),m))
1535+
errorR(Error(FSComp.SR.chkPropertySameNameIndexer(nm, NicePrint.minimalStringOfType cenv.denv typ),m))
15331536

15341537
// Check to see if the signatures of the both getter and the setter imply the same property type
15351538

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp