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

Commit3f7d322

Browse files
committed
adjust for more thorough fsharpqa test runs for multiple interfaces
1 parent6d90572 commit3f7d322

File tree

8 files changed

+104
-29
lines changed

8 files changed

+104
-29
lines changed

‎src/fsharp/check.fs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ and CheckExprInContext (cenv:cenv) (env:env) expr (context:ByrefCallContext) =
491491
CheckTypePermitByrefs cenv m typ
492492
letinterfaces=
493493
[if isInterfaceTy cenv.g typthen
494-
yield typ//yield! AllSuperTypesOfType cenv.g cenv.amap m AllowMultiIntfInstantiations.Yes typ
494+
yield! AllSuperTypesOfType cenv.g cenv.amap m AllowMultiIntfInstantiations.Yes typ
495495
for(ty,_)in iimplsdo
496496
yield! AllSuperTypesOfType cenv.g cenv.amap m AllowMultiIntfInstantiations.Yes ty]
497497
|> List.filter(isInterfaceTy cenv.g)
@@ -1370,7 +1370,10 @@ let CheckEntityDefn cenv env (tycon:Entity) =
13701370
ifnot tycon.IsTypeAbbrevthen
13711371
lettyp= generalizedTyconRef(mkLocalTyconRef tycon)
13721372
letimmediateInterfaces= GetImmediateInterfacesOfType cenv.g cenv.amap m typ
1373-
CheckMultipleInterfaceInstantiations cenv immediateInterfaces m
1373+
letinterfaces=
1374+
[for tyin immediateInterfacesdo
1375+
yield! AllSuperTypesOfType cenv.g cenv.amap m AllowMultiIntfInstantiations.Yes ty]
1376+
CheckMultipleInterfaceInstantiations cenv interfaces m
13741377

13751378
// Check struct fields. We check these late because we have to have first checked that the structs are
13761379
// free of cycles

‎tests/fsharpqa/Source/Conformance/BasicTypeAndModuleDefinitions/GeneratedEqualityHashingComparison/Attributes/New/Test06.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #Regression #Conformance #TypesAndModules #GeneratedEqualityAndHashing #Attributes
2-
//<Expects status="error" span="(9,8-9,9)">This type uses an invalid mix of the attributes 'NoEquality', 'ReferenceEquality', 'StructuralEquality', 'NoComparison' and 'StructuralComparison' attributes$</Expects>
2+
//<Expects status="error" span="(9,8-9,9)">This type uses an invalid mix of the attributes 'NoEquality', 'ReferenceEquality', 'StructuralEquality', 'NoComparison' and 'StructuralComparison'$</Expects>
33
//<Expects status="error" span="(9,8-9,9)" id="FS0385">A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System\.IComparable' or 'System\.Collections\.IStructuralComparable'$</Expects>
44

55
moduleM06=

‎tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ObjectExpressions/E_ObjExprWithSameInterface01.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #Regression #Conformance #DataExpressions #ObjectConstructors
22
// This was Dev10:854519 and Dev11:5525. The fix was to make this a compile error to avoid a runtime exception.
3-
//<Expects status="error" span="(13,5-16,31)">This type implementsor inheritsthe same interface at different generic instantiations 'IQueue<'T>' and 'IQueue<obj>'\. This is not permitted in this version of F#\.$</Expects>
3+
//<Expects status="error" span="(13,5-16,31)">This type implements the same interface at different generic instantiations 'IQueue<'T>' and 'IQueue<obj>'\. This is not permitted in this version of F#\.$</Expects>
44

55
typeIQueue<'a>=
66
abstractAddd:'a->IQueue<'a>

‎tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/ConsumeMultipleInterfaceFromCS.fs‎

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,10 @@ if (t.Home(0) <> 0) then
1515
System.Console.WriteLine("t.Home failed")
1616
res<-false
1717

18-
// Check we can use an object expression implementing a C# interface type inheriting multiple instantiations of an interface
19-
if({new I_003<int>with
20-
member xxx.Home(i)= i
21-
member xxx.Me(c:char)=0
22-
member xxx.Me(s:string)=0
23-
}.Home(
24-
{new I_002<int>with
25-
member x.Me(s)= s
26-
}.Me(0))<>0)then
27-
System.Console.WriteLine("I_003.Home failed")
28-
res<-false
29-
3018
// Check we can use an object expression inheriting from a C# type implementing multiple instantiations of an interface
3119
if(({new T()with
3220
member x.ToString()="a"
33-
interface I_003<int>with
34-
member xxx.Home(i)= i
35-
member xxx.Me(c:char)=0
36-
member xxx.Me(s:string)=0
37-
}:> I_003<int>).Home(
38-
{new I_002<int>with
39-
member x.Me(s)= s
40-
}.Me(0))<>0)then
21+
}:> I_003<int>).Home(4)<>0)then
4122
System.Console.WriteLine("T.Home obj expr failed")
4223
res<-false
4324

@@ -50,10 +31,8 @@ if T().Home(4) <> 0 then
5031
// Check we can inherit from a C# type implementing multiple instantiations of an interface
5132
typeD()=
5233
inherit T()
53-
interface I_003<int>with
54-
memberxxx.Home(i)= i
5534

56-
if(D():> I_003<int>).Home(5)<>5then
35+
if(D():> I_003<int>).Home(5)<>0then
5736
System.Console.WriteLine("D.Home failed")
5837
res<-false
5938

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations #ReqNOMT
2+
// <Expects id="FS0443" status="error" span="(8,6-8,7)">This type implements the same interface at different generic instantiations 'I_002\<string\>' and 'I_002\<char\>'\. This is not permitted in this version of F#\.</Expects>
3+
#light
4+
5+
let mutableres=true
6+
7+
// Check we can't implement an interface inheriting from multiple instantiations of an interface when defining an object expression inheriting from a C# class type
8+
typeD()=
9+
inherit T()
10+
interface I_003<int>with
11+
memberxxx.Home(i)= i
12+
13+
if(D():> I_003<int>).Home(5)<>5then
14+
System.Console.WriteLine("D.Home failed")
15+
res<-false
16+
17+
18+
if(res=true)then
19+
exit0
20+
21+
22+
exit1
23+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// #Conformance #ObjectOrientedTypes #InterfacesAndImplementations #ReqNOMT
2+
// <Expects id="FS0443" status="error" span="(21,6-25,8)">This type implements the same interface at different generic instantiations 'I_002\<string\>' and 'I_002\<char\>'\. This is not permitted in this version of F#\.</Expects>
3+
// <Expects id="FS0443" status="error" span="(33,6-39,8)">This type implements the same interface at different generic instantiations 'I_002\<string\>' and 'I_002\<char\>'\. This is not permitted in this version of F#\.</Expects>
4+
#light
5+
6+
let mutableres=true
7+
lett=new T()
8+
if(t.Me("F#")<>2)then
9+
System.Console.WriteLine("t.Me(string) failed")
10+
res<-false
11+
12+
if(t.Me('a')<>1)then
13+
System.Console.WriteLine("t.Me(char) failed")
14+
res<-false
15+
16+
if(t.Home(0)<>0)then
17+
System.Console.WriteLine("t.Home failed")
18+
res<-false
19+
20+
// Check we can't implement an interface inheriting from multiple instantiations of an interface when defining an object expression implementing a C# interface type
21+
if({new I_003<int>with
22+
member xxx.Home(i)= i
23+
member xxx.Me(c:char)=0
24+
member xxx.Me(s:string)=0
25+
}.Home(
26+
{new I_002<int>with
27+
member x.Me(s)= s
28+
}.Me(0))<>0)then
29+
System.Console.WriteLine("I_003.Home failed")
30+
res<-false
31+
32+
// Check we can't implement an interface inheriting from multiple instantiations of an interface when defining an object expression inheriting from a C# class type
33+
if(({new T()with
34+
member x.ToString()="a"
35+
interface I_003<int>with
36+
member xxx.Home(i)= i
37+
member xxx.Me(c:char)=0
38+
member xxx.Me(s:string)=0
39+
}:> I_003<int>).Home(
40+
{new I_002<int>with
41+
member x.Me(s)= s
42+
}.Me(0))<>0)then
43+
System.Console.WriteLine("T.Home obj expr failed")
44+
res<-false
45+
46+
// Check we can create an object of a C# type implementing multiple instantiations of an interface
47+
if T().Home(4)<>0then
48+
System.Console.WriteLine("T.Home failed")
49+
res<-false
50+
51+
52+
// Check we can't implement an interface inheriting from multiple instantiations of an interface when defining an object expression inheriting from a C# class type
53+
typeD()=
54+
inherit T()
55+
interface I_003<int>with
56+
memberxxx.Home(i)= i
57+
58+
if(D():> I_003<int>).Home(5)<>5then
59+
System.Console.WriteLine("D.Home failed")
60+
res<-false
61+
62+
63+
if(res=true)then
64+
exit0
65+
66+
67+
exit1
68+

‎tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/InterfaceTypes/env.lst‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ NoMTSOURCE=CallCSharpInterface.fs PRECMD="\$CSC_PIPE /t:library ConsumeFromFS.
3030

3131
SOURCE=E_MultipleInterfaceInheritance.fs SCFLAGS="--test:ErrorRanges --flaterrors"# E_MultipleInterfaceInheritance.fs
3232

33-
NoMTSOURCE=ConsumeMultipleInterfaceFromCS.fs PRECMD="\$CSC_PIPE /t:library MultipleInterfaceInheritanceFromCS.cs" SCFLAGS="-r:MultipleInterfaceInheritanceFromCS.dll --test:ErrorRanges"# ConsumeMultipleInterfaceFromCS.fs
33+
NoMTSOURCE=ConsumeMultipleInterfaceFromCS.fs PRECMD="\$CSC_PIPE /t:library MultipleInterfaceInheritanceFromCS.cs" SCFLAGS="-r:MultipleInterfaceInheritanceFromCS.dll"# ConsumeMultipleInterfaceFromCS.fs
34+
NoMTSOURCE=E_ConsumeMultipleInterfaceFromCS.fs PRECMD="\$CSC_PIPE /t:library MultipleInterfaceInheritanceFromCS.cs" SCFLAGS="-r:MultipleInterfaceInheritanceFromCS.dll --test:ErrorRanges"# E_ConsumeMultipleInterfaceFromCS.fs
35+
NoMTSOURCE=E_ClassConsumeMultipleInterfaceFromCS.fs PRECMD="\$CSC_PIPE /t:library MultipleInterfaceInheritanceFromCS.cs" SCFLAGS="-r:MultipleInterfaceInheritanceFromCS.dll --test:ErrorRanges"# E_ClassConsumeMultipleInterfaceFromCS.fs
3436

3537
SOURCE="E_ImplementGenIFaceTwice01.fs"# E_ImplementGenIFaceTwice01.fs
3638
SOURCE="E_ImplementGenIFaceTwice02.fs"# E_ImplementGenIFaceTwice02.fs

‎tests/fsharpqa/Source/Conformance/UnitsOfMeasure/TypeChecker/E_GenInterfaceWithDifferentGenInstantiations.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// #Regression #Conformance #UnitsOfMeasure #TypeInference #TypeConstraints
22
// Regression test for FSHARP1.0:4782
33
// It is illegal to implement or inherit the same interface at different generic instantiations
4-
//<Expects status="error" span="(13,6-13,8)">This type implementsor inheritsthe same interface at different generic instantiations 'IA<kg>' and 'IA<'b>'\. This is not permitted in this version of F#</Expects>
4+
//<Expects status="error" span="(13,6-13,8)">This type implements the same interface at different generic instantiations 'IA<kg>' and 'IA<'b>'\. This is not permitted in this version of F#</Expects>
55

66
[<Measure>]typekg
77

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp