Skip to content

Recursive namespaces not working properly with type providers static parameters #5227

@francotiveron

Description

@francotiveron

Using the following tools

Microsoft Visual Studio Community 2017 Preview
Version 15.8.0 Preview 2.0
VisualStudio.15.Preview/15.8.0-pre.2.0+27729.1
Microsoft .NET Framework
Version 4.7.02558
on Windows 10

Repro steps

  1. Create a library project
  2. Change the Target .NET Framework version to 4.5.2
  3. Change Target F# version to 4.1 (Core 4.4.3.0)
  4. Install SQLProvider package from NuGet
  5. Replace Library1.fs content with the following code
namespace Ns1
#nowarn "40"

open FSharp.Data.Sql

[<AutoOpen>]
module Definitions =
    let [<Literal>] connString = @"Valid connection string"
    let t1 = T1() //T1 not defined

type T1() = 
    static member f1() = connString

type amplaSQL = SqlDataProvider<ConnectionString = connString>

As expected 'let t1 = T1()' gives an error, being the type T1 defined later in the file. This is what rec namespace should allow

  1. Change the first line to 'namespace rec Ns1'

Expected behavior

No errors

Actual behavior

As expected, the previous error goes away as T1 is now known even in the affected line. However, a new unexpected error comes up in the last code line, complaining that connString is not defined


namespace rec Ns1
#nowarn "40"

open FSharp.Data.Sql

[<AutoOpen>]
module Definitions =
    let [<Literal>] connString = @"Valid connection string"
    let t1 = T1()

type T1() = 
    static member f1() = connString

type amplaSQL = SqlDataProvider<ConnectionString = connString> //connString not defined


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions