-
Notifications
You must be signed in to change notification settings - Fork 830
Description
When upgrading to VS 2017 and F# 4.1 some of my old projects won't compile with:
error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
Repro steps
type OpDynamic() =
static member ( ? ) (x, n) = x
member x.Prop = 1
[<EntryPoint>]
let main argv =
let op = OpDynamic ()
let op2 = op?Hello.Prop
printfn "%A" argv
0Expected behavior
Compilation succeed with intended behavior
Actual behavior
Fails with
error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
Known workarounds
If I change:
let op2 = op?Hello.PropInto
let op2 = (op?Hello).Propit seems to work
Also if I change from:
type OpDynamic() =
static member ( ? ) (x, n) = x
member x.Prop = 1type OpDynamic() =
member x.Prop = 1
let ( ? ) x n = xThe reason I made Op_Dynamic a member function was that I hoped not to pollute the namespace with global operators. Perhaps a misguided idea.
Related information
- New F# project, no changes
- Windows 10 64bit
- Visual Studio
Microsoft Visual Studio Community 2017 RC
Version 15.0.26206.0 D15REL
Microsoft .NET Framework
Version 4.6.01586
Installed Version: Community
Visual Basic 2017 RC 00369-50000-00000-AA988
Microsoft Visual Basic 2017 RC
Visual C# 2017 RC 00369-50000-00000-AA988
Microsoft Visual C# 2017 RC
Visual C++ 2017 RC 00369-50000-00000-AA988
Microsoft Visual C++ 2017 RC
Visual F# 4.1 00369-50000-00000-AA988
Microsoft Visual F# 4.1
ASP.NET and Web Tools 2017 15.0.30206.0
ASP.NET and Web Tools 2017
Common Azure Tools 1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
JavaScript Language Service 2.0
JavaScript Language Service
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 4.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Visual Studio tools for CMake 1.0
Visual Studio tools for CMake