Skip to content

Obsolete Attribute on AutoOpen Modules #1391

@matthid

Description

@matthid

When you create an [<AutoOpen>] Module and later decide to mark it as obsolete, most of the time no warning will be triggered on the consumer side.

Repro steps

lib.fs:

[<System.Obsolete("This is obsolete")>]
[<AutoOpen>]
module MyNamespace.MyModule

let testFun () = printfn "test"

script.fsx

#r "lib.dll"

open MyNamespace

testFun ()
  1. fsc -a lib.fs
  2. fsi test.fsx

Expected behavior

script.fsx(3,6): warning FS0044: This construct is deprecated. This is obsolete
test

Actual behavior

test

Known workarounds

Mark all module members as obsolete...

Related information

  • Operating system: Windows 10 x64
  • Visual Studio 2015 Update 3
  • Severity: Annoyance

IMHO the F# compiler should only warn when the obsolete module is actually used in the current context. It would even be fine when fsc would warn on the the first instance (as fsc is a single pass compiler).
Giving no warning at all feels like a bug...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions