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
1 change: 0 additions & 1 deletion eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<PropertyGroup>
<GitHubRepositoryName>fsharp</GitHubRepositoryName>
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
<SourceBuildTrimNetFrameworkTargets>true</SourceBuildTrimNetFrameworkTargets>
</PropertyGroup>

<!--
Expand Down
8 changes: 6 additions & 2 deletions src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4142,7 +4142,9 @@ module TcDeclarations =

// Convert auto properties to let bindings in the pre-list
let rec preAutoProps memb =
match memb with
match memb with
| SynMemberDefn.AutoProperty(ident = id) when id.idText = "" -> []

| SynMemberDefn.AutoProperty(attributes=Attributes attribs; isStatic=isStatic; ident=id; typeOpt=tyOpt; propKind=propKind; xmlDoc=xmlDoc; synExpr=synExpr; range=mWholeAutoProp) ->
// Only the keep the field-targeted attributes
let attribs = attribs |> List.filter (fun a -> match a.Target with Some t when t.idText = "field" -> true | _ -> false)
Expand All @@ -4169,7 +4171,9 @@ module TcDeclarations =

// Convert auto properties to member bindings in the post-list
let rec postAutoProps memb =
match memb with
match memb with
| SynMemberDefn.AutoProperty(ident = id) when id.idText = "" -> []

| SynMemberDefn.AutoProperty(attributes=Attributes attribs; isStatic=isStatic; ident=id; typeOpt=tyOpt; propKind=propKind; memberFlags=memberFlags; memberFlagsForSet=memberFlagsForSet; xmlDoc=xmlDoc; accessibility=access; trivia = { GetSetKeywords = mGetSetOpt }) ->
let mMemberPortion = id.idRange
// Only the keep the non-field-targeted attributes
Expand Down
3 changes: 2 additions & 1 deletion src/Compiler/Driver/GraphChecking/GraphProcessing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ let processGraph<'Item, 'Result when 'Item: equality and 'Item: comparison>
/// Only the first exception encountered is stored - this can cause non-deterministic errors if more than one item fails.
let raiseExn, getExn =
let mutable exn: ('Item * System.Exception) option = None
let lockObj = obj ()
// Only set the exception if it hasn't been set already
let setExn newExn =
lock exn (fun () ->
lock lockObj (fun () ->
match exn with
| Some _ -> ()
| None -> exn <- newExn
Expand Down
50 changes: 50 additions & 0 deletions src/Compiler/SyntaxTree/ParseHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,3 +1099,53 @@ let mkSynUnionCase attributes (access: SynAccess option) id kind mDecl (xmlDoc,
let trivia: SynUnionCaseTrivia = { BarRange = Some mBar }
let mDecl = unionRangeWithXmlDoc xmlDoc mDecl
SynUnionCase(attributes, id, kind, xmlDoc, None, mDecl, trivia)

let mkAutoPropDefn mVal access ident typ mEquals (expr: SynExpr) accessors xmlDoc attribs flags rangeStart =
let mWith, (getSet, getSetOpt) = accessors
let memberRange = unionRanges rangeStart expr.Range |> unionRangeWithXmlDoc xmlDoc
let flags, leadingKeyword = flags
let leadingKeyword = appendValToLeadingKeyword mVal leadingKeyword
let memberFlags: SynMemberFlags = flags SynMemberKind.Member
let memberFlagsForSet = flags SynMemberKind.PropertySet
let isStatic = not memberFlags.IsInstance

let trivia =
{
LeadingKeyword = leadingKeyword
WithKeyword = mWith
EqualsRange = mEquals
GetSetKeywords = getSetOpt
}

SynMemberDefn.AutoProperty(
attribs,
isStatic,
ident,
typ,
getSet,
memberFlags,
memberFlagsForSet,
xmlDoc,
access,
expr,
memberRange,
trivia
)

let mkValField mVal mRhs mut access ident (typ: SynType) xmlDoc rangeStart attribs mStaticOpt =
let isStatic = Option.isSome mStaticOpt
let mValDecl = unionRanges rangeStart typ.Range |> unionRangeWithXmlDoc xmlDoc

let leadingKeyword =
match mStaticOpt with
| None -> SynLeadingKeyword.Val mVal
| Some mStatic -> SynLeadingKeyword.StaticVal(mStatic, mVal)

let fld =
SynField(attribs, isStatic, Some ident, typ, mut, xmlDoc, access, mRhs, { LeadingKeyword = Some leadingKeyword })

SynMemberDefn.ValField(fld, mValDecl)

let mkSynField parseState idOpt t isMutable vis attributes isStatic mWhole leadingKeyword =
let xmlDoc = grabXmlDocAtRangeStart (parseState, attributes, mWhole)
SynField(attributes, isStatic, idOpt, t, isMutable, xmlDoc, vis, mWhole, { LeadingKeyword = leadingKeyword })
39 changes: 39 additions & 0 deletions src/Compiler/SyntaxTree/ParseHelpers.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,42 @@ val mkSynUnionCase:
mDecl: range ->
(PreXmlDoc * range) ->
SynUnionCase

val mkAutoPropDefn:
mVal: range ->
access: SynAccess option ->
ident: Ident ->
typ: SynType option ->
mEquals: range option ->
expr: SynExpr ->
accessors: range option * (SynMemberKind * GetSetKeywords option) ->
xmlDoc: PreXmlDoc ->
attribs: SynAttributes ->
flags: (SynMemberKind -> SynMemberFlags) * SynLeadingKeyword ->
rangeStart: range ->
SynMemberDefn

val mkValField:
mVal: range ->
mRhs: range ->
mut: bool ->
access: SynAccess option ->
ident: Ident ->
typ: SynType ->
xmlDoc: PreXmlDoc ->
range ->
SynAttributes ->
range option ->
SynMemberDefn

val mkSynField:
parseState: IParseState ->
idOpt: Ident option ->
t: SynType ->
isMutable: bool ->
vis: SynAccess option ->
attributes: SynAttributeList list ->
isStatic: bool ->
mWhole: range ->
leadingKeyword: SynLeadingKeyword option ->
SynField
1 change: 0 additions & 1 deletion src/Compiler/SyntaxTree/PrettyNaming.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ open System.Collections.Concurrent
open System.Globalization
open System.Text

open FSharp.Compiler.AbstractIL
open Internal.Utilities.Library
open FSharp.Compiler.Text
open FSharp.Compiler.Text.Layout
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/SyntaxTree/XmlDoc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ open FSharp.Compiler.DiagnosticsLogger
open FSharp.Compiler.IO
open FSharp.Compiler.Text
open FSharp.Compiler.Text.Range
open FSharp.Compiler.AbstractIL.IL

/// Represents collected XmlDoc lines
[<RequireQualifiedAccess>]
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/SyntaxTree/XmlDoc.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace FSharp.Compiler.Xml

open FSharp.Compiler.Text
open FSharp.Compiler.AbstractIL.IL

/// Represents collected XmlDoc lines
[<Class>]
Expand Down
Loading