Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions src/fsharp/NameResolution.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3123,30 +3123,33 @@ let private ResolveExprDotLongIdent (ncenv:NameResolver) m ad nenv typ lid findF
let typeNameResInfo = TypeNameResolutionInfo.Default
let adhoctDotSearchAccessible = AtMostOneResult m (ResolveLongIdentInTypePrim ncenv nenv LookupKind.Expr ResolutionInfo.Empty 1 m ad lid findFlag typeNameResInfo typ)
match adhoctDotSearchAccessible with
| Exception _ ->
| Exception _ ->
// If the dot is not resolved by adhoc overloading then look for a record field
// that can resolve the name.
let dotFieldIdSearch =
match lid with
// A unique record label access, e.g expr.field
| id::rest when nenv.eFieldLabels.ContainsKey(id.idText) ->
match nenv.eFieldLabels.[id.idText] with
| [] -> NoResultsOrUsefulErrors
| rfref :: _ ->
// NOTE (instantiationGenerator cleanup): we need to freshen here because we don't know the type.
// But perhaps the caller should freshen??
let item = FreshenRecdFieldRef ncenv m rfref
OneSuccess (ResolutionInfo.Empty,item,rest)
| _ -> NoResultsOrUsefulErrors
let dotFieldIdSearch =
// If the type is already known, we should not try to lookup a record field
if isAppTy ncenv.g typ then
NoResultsOrUsefulErrors
else
match lid with
// A unique record label access, e.g expr.field
| id::rest when nenv.eFieldLabels.ContainsKey(id.idText) ->
match nenv.eFieldLabels.[id.idText] with
| [] -> NoResultsOrUsefulErrors
| rfref :: _ ->
// NOTE (instantiationGenerator cleanup): we need to freshen here because we don't know the type.
// But perhaps the caller should freshen??
let item = FreshenRecdFieldRef ncenv m rfref
OneSuccess (ResolutionInfo.Empty,item,rest)
| _ -> NoResultsOrUsefulErrors

let search = dotFieldIdSearch
match AtMostOneResult m search with
| Result _ as res -> ForceRaise res
| _ ->
let adhocDotSearchAll = ResolveLongIdentInTypePrim ncenv nenv LookupKind.Expr ResolutionInfo.Empty 1 m AccessibleFromSomeFSharpCode lid findFlag typeNameResInfo typ
ForceRaise (AtMostOneResult m (search +++ adhocDotSearchAll))

| Result _ ->
| _ ->
ForceRaise adhoctDotSearchAccessible

let ComputeItemRange wholem (lid: Ident list) rest =
Expand Down
3 changes: 3 additions & 0 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,9 @@ module TypecheckTests =
let cfg = { cfg with fsc_flags = cfg.fsc_flags + " --warnon:3218" }
singleNegTest cfg "neg100"

[<Test>]
let ``type check neg101`` () = singleNegTest (testConfig "typecheck/sigs") "neg101"

[<Test>]
let ``type check neg_byref_1`` () = singleNegTest (testConfig "typecheck/sigs") "neg_byref_1"

Expand Down
2 changes: 2 additions & 0 deletions tests/fsharp/typecheck/sigs/neg101.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

neg101.fs(7,11,7,14): typecheck error FS0039: The field, constructor or member 'Foo' is not defined.
9 changes: 9 additions & 0 deletions tests/fsharp/typecheck/sigs/neg101.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

module M

type MyRec = { Foo: string }

let x: int = 1
let y = x.Foo
let f1 z = z.Foo
let f2 (z: MyRec) = z.Foo
20 changes: 0 additions & 20 deletions vsintegration/Vsix/RegisterFsharpPackage.pkgdef
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,6 @@
"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""

[$RootKey$\Projects\{A1591282-1198-4647-A2B1-27E5FF5F6F3B}\LanguageTemplates]
"{F2A71F9B-5D33-465A-A702-920D77279786}"="{76B279E8-36ED-494E-B145-5344F8DEFCB6}"

[$RootKey$\Projects\{349C5851-65DF-11DA-9384-00065B846F21}\LanguageTemplates]
"{F2A71F9B-5D33-465A-A702-920D77279786}"="{76B279E8-36ED-494E-B145-5344F8DEFCB6}"

[$RootKey$\Projects\{76B279E8-36ED-494E-B145-5344F8DEFCB6}]
"Language(VsTemplate)"="FSharp"
"Package"="{91A04A73-4F2C-4E7C-AD38-C1A68E7DA05C}"
"ShowOnlySpecifiedTemplates(VsTemplate)"="00000000"
"TemplateGroupIDs(VsTemplate)"="Silverlight"
@="F# Silverlight Project Templates"

[$RootKey$\Projects\{76B279E8-36ED-494E-B145-5344F8DEFCB6}\SilverlightProperties]
"CodeFileExtension"=".fs"
"TemplateFolder"="FSharp"
"DefaultProjectTemplate"="SilverlightLibrary\SilverlightLibrary.vstemplate"
"LanguageDisplayString"="Visual F#"
"PropertyPagesToRemove"="{6D2D9B56-2691-4624-A1BF-D07A14594748};{9CFBEB2A-6824-43e2-BD3B-B112FEBC3772}"

[$RootKey$\InstalledProducts\Microsoft Visual F#]
"Package"="{91a04a73-4f2c-4e7c-ad38-c1a68e7da05c}"
"ProductDetails"="#9002"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,13 @@ type internal FSharpProjectOptionsManager
}

member this.UpdateProjectInfoWithProjectId(projectId:ProjectId, userOpName) =
let project = workspace.CurrentSolution.GetProject(projectId)
let siteProvider = this.ProvideProjectSiteProvider(project)
this.UpdateProjectInfo(tryGetOrCreateProjectId, projectId, siteProvider.GetProjectSite(), userOpName)
let hier = workspace.GetHierarchy(projectId)
match hier with
| h when (h.IsCapabilityMatch("CPS")) ->
let project = workspace.CurrentSolution.GetProject(projectId)
let siteProvider = this.ProvideProjectSiteProvider(project)
this.UpdateProjectInfo(tryGetOrCreateProjectId, projectId, siteProvider.GetProjectSite(), userOpName)
| _ -> ()

member this.UpdateProjectInfoWithPath(path, userOpName) =
let projectId = workspace.ProjectTracker.GetOrCreateProjectIdForPath(path, projectDisplayNameOf path)
Expand Down