Skip to content

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

Closed

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


Activity

  1. added this to the 16.0 milestone on Aug 13, 2018
  2. modified the milestones: 16.0, 16.1 on Feb 21, 2019
  3. modified the milestones: 16.1, 16.2 on Apr 23, 2019
  4. modified the milestones: 16.2, Backlog on Apr 30, 2019
  5. dsyme commented on Aug 26, 2020

    @dsyme
    Contributor

    Same issue as #6338

  6. removed this from the Backlog milestone on Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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