Skip to content

Commit

Permalink
Show warning when Record is accessed without type but RequiredQualifi…
Browse files Browse the repository at this point in the history
…edAccess was set - relates to dotnet#95
  • Loading branch information
forki committed Jan 26, 2015
1 parent 0f1df31 commit 2a0202a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fsharp/nameres.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,10 @@ let rec ResolveFieldInModuleOrNamespace (ncenv:NameResolver) nenv ad (resInfo:Re
let modulScopedFieldNames =
match TryFindTypeWithRecdField modref id with
| Some tycon when IsEntityAccessible ncenv.amap m ad (modref.MkNestedTyconRef tycon) ->
let showDeprecated = HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs
if showDeprecated then
let message = sprintf "The record type for the record case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('%s') in the name you are using.'" (id.ToString()) tycon.DisplayName
warning(Deprecated(message,m))
success(modref.MkNestedRecdFieldRef tycon id, rest)
| _ -> error
// search for type-qualified names, e.g. { Microsoft.FSharp.Core.Ref.contents = 1 }
Expand Down

0 comments on commit 2a0202a

Please sign in to comment.