30 people like it.
Like the snippet!
Compiler Regression in VS2010-SP1
Compiler regression in VS2010-SP1 ?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
|
// VS2010: This works as expected (fsc.exe version: 4.0.30319.1)
// Note: The types are mutually recursive with "and"
// plus we're NOT using the implicit constructor
type SuperType() =
abstract Foo : int -> int
default x.Foo a = a + 1
and SubType1() =
inherit SuperType()
override x.Foo a = base.Foo(a)
// VS2010-SP1: Works as expected (fsc.exe version 4.0.40219.1)
// Note: The types are not mutually recursive with "and"
type SuperType2() =
abstract Foo : int -> int
default x.Foo a = a + 1
type SubType2 =
inherit SuperType2
new () = { inherit SuperType2() }
override x.Foo a = base.Foo(a)
// VS2010-SP1: Works as expected (fsc.exe version 4.0.40219.1)
// Note: We're using the implicit constructor
type SuperType3() =
abstract Foo : int -> int
default x.Foo a = a + 1
type SubType3() =
inherit SuperType3()
override x.Foo a = base.Foo(a)
// VS2010-SP1: This will not work as expected (fsc.exe version 4.0.40219.1)
// Note: The types are mutually recursive with "and"
// plus we're NOT using the implicit constructor
// this causes the base reference to fail to compile
type SuperType4() =
abstract Foo : int -> int
default x.Foo a = a + 1
and SubType4 =
inherit SuperType4
new () = { inherit SuperType4() }
// With visual studio SP1 this will not compile
// with the following error:
//
// Error 1 'base' values may only be used to make direct calls
// to the base implementations of overridden members <file> <line>
override x.Foo a = base.Foo(a)
|
Multiple items
type SuperType =
new : unit -> SuperType
abstract member Foo : int -> int
override Foo : a:int -> int
Full name: Script.SuperType
--------------------
new : unit -> SuperType
abstract member SuperType.Foo : int -> int
Full name: Script.SuperType.Foo
Multiple items
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
val x : SuperType
override SuperType.Foo : a:int -> int
Full name: Script.SuperType.Foo
val a : int
Multiple items
type SubType1 =
inherit SuperType
new : unit -> SubType1
override Foo : a:int -> int
Full name: Script.SubType1
--------------------
new : unit -> SubType1
val x : SubType1
override SubType1.Foo : a:int -> int
Full name: Script.SubType1.Foo
Multiple items
type SuperType2 =
new : unit -> SuperType2
abstract member Foo : int -> int
override Foo : a:int -> int
Full name: Script.SuperType2
--------------------
new : unit -> SuperType2
abstract member SuperType2.Foo : int -> int
Full name: Script.SuperType2.Foo
val x : SuperType2
override SuperType2.Foo : a:int -> int
Full name: Script.SuperType2.Foo
Multiple items
type SubType2 =
inherit SuperType2
new : unit -> SubType2
override Foo : a:int -> int
Full name: Script.SubType2
--------------------
new : unit -> SubType2
val x : SubType2
override SubType2.Foo : a:int -> int
Full name: Script.SubType2.Foo
Multiple items
type SuperType3 =
new : unit -> SuperType3
abstract member Foo : int -> int
override Foo : a:int -> int
Full name: Script.SuperType3
--------------------
new : unit -> SuperType3
abstract member SuperType3.Foo : int -> int
Full name: Script.SuperType3.Foo
val x : SuperType3
override SuperType3.Foo : a:int -> int
Full name: Script.SuperType3.Foo
Multiple items
type SubType3 =
inherit SuperType3
new : unit -> SubType3
override Foo : a:int -> int
Full name: Script.SubType3
--------------------
new : unit -> SubType3
val x : SubType3
override SubType3.Foo : a:int -> int
Full name: Script.SubType3.Foo
Multiple items
type SuperType4 =
new : unit -> SuperType4
abstract member Foo : int -> int
override Foo : a:int -> int
Full name: Script.SuperType4
--------------------
new : unit -> SuperType4
abstract member SuperType4.Foo : int -> int
Full name: Script.SuperType4.Foo
val x : SuperType4
override SuperType4.Foo : a:int -> int
Full name: Script.SuperType4.Foo
Multiple items
type SubType4 =
inherit SuperType4
new : unit -> SubType4
override Foo : a:int -> int
Full name: Script.SubType4
--------------------
new : unit -> SubType4
val x : SubType4
override SubType4.Foo : a:int -> int
Full name: Script.SubType4.Foo
More information