Skip to content

Commit e81c4fe

Browse files
authored
Merge pull request #635 from dsyme/integrate-663
Integrate from fsharp\fsharp master
2 parents 8ecb153 + f04c9c2 commit e81c4fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+722
-518
lines changed

CHANGELOG-fsharp.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
4.0.1.3
2+
* Integrate Microsoft\visualfsharp to 688c26bdbbfc766326fc45e4d918f87fcba1e7ba. F# 4.1 work
3+
* [Inlined function causes "FS0078: Unable to find the file"](https://github.com/fsharp/fsharp/issues/584)
4+
15
4.0.1.2
26
* Integrate Microsoft\visualfsharp to 5d8126a. F# 4.1 work
37
* FCS API integration and alignment

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#### 7.0.0
2+
* Integrate fsharp\fsharp and Microsoft\visualfsharp to 835b79c041f9032fceeceb39f680e0662cba92ec
3+
14
#### 6.0.2
25
* [Fix #568: recognize provided expressions](https://github.com/fsharp/FSharp.Compiler.Service/pull/568)
36

src/absil/il.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2982,8 +2982,14 @@ let mdef_code2code f md =
29822982
let prependInstrsToCode (instrs: ILInstr list) (c2: ILCode) =
29832983
let instrs = Array.ofList instrs
29842984
let n = instrs.Length
2985-
{ c2 with Labels = Dictionary.ofList [ for kvp in c2.Labels -> (kvp.Key, kvp.Value + n) ]
2986-
Instrs = Array.append instrs c2.Instrs }
2985+
match c2.Instrs.[0] with
2986+
// If there is a sequence point as the first instruction then keep it at the front
2987+
| I_seqpoint _ as i0 ->
2988+
{ c2 with Labels = Dictionary.ofList [ for kvp in c2.Labels -> (kvp.Key, if kvp.Value = 0 then 0 else kvp.Value + n) ]
2989+
Instrs = Array.append [| i0 |] (Array.append instrs c2.Instrs.[1..]) }
2990+
| _ ->
2991+
{ c2 with Labels = Dictionary.ofList [ for kvp in c2.Labels -> (kvp.Key, kvp.Value + n) ]
2992+
Instrs = Array.append instrs c2.Instrs }
29872993

29882994
let prependInstrsToMethod new_code md =
29892995
mdef_code2code (prependInstrsToCode new_code) md

src/absil/ilsupp.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ type ResFormatNode(tid:int32, nid:int32, lid:int32, dataOffset:int32, pbLinkedRe
535535
let SaveChunk(p : byte[], sz : int) =
536536
if Unchecked.defaultof<byte[]> <> pUnlinkedResource then
537537
Bytes.blit p 0 pUnlinkedResource (!unlinkedResourceOffset + offset) sz
538-
unlinkedResourceOffset := !unlinkedResourceOffset + sz ;
539-
size := !size + sz ;
538+
unlinkedResourceOffset := !unlinkedResourceOffset + sz
539+
size := !size + sz
540540

541541
()
542542

@@ -846,10 +846,10 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
846846
let rfh = ResFormatHeader()
847847
let rfhBytes = rfh.toBytes()
848848
Bytes.blit rfhBytes 0 pResBuffer 0 ResFormatHeader.Width
849-
resBufferOffset <- resBufferOffset + ResFormatHeader.Width ;
849+
resBufferOffset <- resBufferOffset + ResFormatHeader.Width
850850

851851
for i = 0 to (nResNodes - 1) do
852-
resBufferOffset <- resBufferOffset + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) ;
852+
resBufferOffset <- resBufferOffset + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset)
853853

854854
pResBuffer
855855
#endif

src/absil/ilx.fs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ type IlxClosureSpec =
120120
type IlxClosureInfo =
121121
{ cloStructure: IlxClosureLambdas
122122
cloFreeVars: IlxClosureFreeVar[]
123-
cloCode: Lazy<ILMethodBody>
124-
cloSource: ILSourceMarker option}
123+
cloCode: Lazy<ILMethodBody> }
125124

126125
type IlxUnionInfo =
127126
{ /// is the representation public?

src/absil/ilx.fsi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ type IlxClosureApps =
9797
type IlxClosureInfo =
9898
{ cloStructure: IlxClosureLambdas
9999
cloFreeVars: IlxClosureFreeVar[]
100-
cloCode: Lazy<ILMethodBody>
101-
cloSource: ILSourceMarker option}
100+
cloCode: Lazy<ILMethodBody> }
102101

103102
type IlxUnionInfo =
104103
{ /// Is the representation public?

src/fsharp/CompileOps.fs

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,28 +1640,38 @@ let DefaultBasicReferencesForOutOfProjectSources40 = []
16401640

16411641
#else
16421642
let DefaultBasicReferencesForOutOfProjectSources =
1643-
[ yield "System"
1643+
[ // These are .NET-Framework -style references
1644+
#if !TODO_REWORK_ASSEMBLY_LOAD
1645+
yield "System"
16441646
yield "System.Xml"
16451647
yield "System.Runtime.Remoting"
16461648
yield "System.Runtime.Serialization.Formatters.Soap"
16471649
yield "System.Data"
16481650
yield "System.Drawing"
1649-
1650-
// Don't reference System.Core for .NET 2.0 compilations.
1651-
//
1652-
// We only use a default reference to System.Core if one exists which we can load it into the compiler process.
1653-
// Note: this is not a partiuclarly good technique as it relying on the environment the compiler is executing in
1654-
// to determine the default references. However, System.Core will only fail to load on machines with only .NET 2.0,
1655-
// in which case the compiler will also be running as a .NET 2.0 process.
1656-
//
1657-
// NOTE: it seems this can now be removed now that .NET 4.x is minimally assumed when using this toolchain
1658-
if (try System.Reflection.Assembly.Load(new System.Reflection.AssemblyName("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")) |> ignore; true with _ -> false) then
1659-
yield "System.Core"
1651+
yield "System.Core"
1652+
#endif
16601653

1661-
yield "System.Runtime"
1654+
// These are the Portable-profile and .NET Standard 1.6 dependencies of FSharp.Core.dll. These are needed
1655+
// when an F# sript references an F# profile 7, 78, 259 or .NET Standard 1.6 component which in turn refers
1656+
// to FSharp.Core for profile 7, 78, 259 or .NET Standard.
1657+
yield "System.Runtime" // lots of types
1658+
yield "System.Linq" // System.Linq.Expressions.Expression<T>
1659+
yield "System.Reflection" // System.Reflection.ParameterInfo
1660+
yield "System.Linq.Expressions" // System.Linq.IQueryable<T>
1661+
yield "System.Threading.Tasks" // valuetype [System.Threading.Tasks]System.Threading.CancellationToken
1662+
yield "System.IO" // System.IO.TextWriter
1663+
//yield "System.Console" // System.Console.Out etc.
1664+
yield "System.Net.Requests" // System.Net.WebResponse etc.
1665+
yield "System.Collections" // System.Collections.Generic.List<T>
1666+
yield "System.Runtime.Numerics" // BigInteger
1667+
yield "System.Threading" // OperationCanceledException
1668+
1669+
#if !TODO_REWORK_ASSEMBLY_LOAD
16621670
yield "System.Web"
16631671
yield "System.Web.Services"
1664-
yield "System.Windows.Forms" ]
1672+
yield "System.Windows.Forms"
1673+
#endif
1674+
]
16651675

16661676
// Extra implicit references for .NET 4.0
16671677
let DefaultBasicReferencesForOutOfProjectSources40 =
@@ -2218,11 +2228,7 @@ type TcConfigBuilder =
22182228
resolutionAssemblyFoldersConditions = ""
22192229
platform = None
22202230
prefer32Bit = false
2221-
#if ENABLE_MONO_SUPPORT
22222231
useSimpleResolution = runningOnMono
2223-
#else
2224-
useSimpleResolution = false
2225-
#endif
22262232
target = ConsoleExe
22272233
debuginfo = false
22282234
testFlagEmitFeeFeeAs100001 = false
@@ -3655,8 +3661,8 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR
36553661
member __.GetRawFSharpSignatureData(m,ilShortAssemName,filename) =
36563662
let resources = ilModule.Resources.AsList
36573663
let sigDataReaders =
3658-
[ for iresource in resources do
3659-
if IsSignatureDataResource iresource then
3664+
[ for iresource in resources do
3665+
if IsSignatureDataResource iresource then
36603666
let ccuName = GetSignatureDataResourceName iresource
36613667
let byteReader = iresource.GetByteReader(m)
36623668
yield (ccuName, byteReader()) ]
@@ -3665,9 +3671,9 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR
36653671
if List.contains ilShortAssemName externalSigAndOptData then
36663672
let sigFileName = Path.ChangeExtension(filename, "sigdata")
36673673
if not sigDataReaders.IsEmpty then
3668-
error(Error(FSComp.SR.buildDidNotExpectSigdataResource(),m))
3669-
if not (FileSystem.SafeExists sigFileName) then
3670-
error(Error(FSComp.SR.buildExpectedSigdataFile(), m))
3674+
error(Error(FSComp.SR.buildDidNotExpectSigdataResource(FileSystem.GetFullPathShim filename),m))
3675+
if not (FileSystem.SafeExists sigFileName) then
3676+
error(Error(FSComp.SR.buildExpectedSigdataFile (FileSystem.GetFullPathShim sigFileName), m))
36713677
[ (ilShortAssemName, FileSystem.ReadAllBytesShim sigFileName)]
36723678
else
36733679
sigDataReaders
@@ -3682,9 +3688,9 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR
36823688
if List.contains ilShortAssemName externalSigAndOptData then
36833689
let optDataFile = Path.ChangeExtension(filename, "optdata")
36843690
if not optDataReaders.IsEmpty then
3685-
error(Error(FSComp.SR.buildDidNotExpectOptDataResource(),m))
3691+
error(Error(FSComp.SR.buildDidNotExpectOptDataResource(FileSystem.GetFullPathShim filename),m))
36863692
if not (FileSystem.SafeExists optDataFile) then
3687-
error(Error(FSComp.SR.buildExpectedFileAlongSideFSharpCore(optDataFile),m))
3693+
error(Error(FSComp.SR.buildExpectedFileAlongSideFSharpCore(optDataFile,FileSystem.GetFullPathShim optDataFile),m))
36883694
[ (ilShortAssemName, (fun () -> FileSystem.ReadAllBytesShim optDataFile))]
36893695
else
36903696
optDataReaders
@@ -5133,12 +5139,11 @@ let GetInitialTcEnv (thisAssemblyName:string, initm:range, tcConfig:TcConfig, tc
51335139

51345140
let tcEnv = CreateInitialTcEnv(tcGlobals, amap, initm, thisAssemblyName, ccus)
51355141

5136-
let tcEnv =
5137-
if tcConfig.checkOverflow then
5138-
TcOpenDecl TcResultsSink.NoSink tcGlobals amap initm initm tcEnv (pathToSynLid initm (splitNamespace FSharpLib.CoreOperatorsCheckedName))
5139-
else
5140-
tcEnv
5141-
tcEnv
5142+
if tcConfig.checkOverflow then
5143+
try TcOpenDecl TcResultsSink.NoSink tcGlobals amap initm initm tcEnv (pathToSynLid initm (splitNamespace FSharpLib.CoreOperatorsCheckedName))
5144+
with e -> errorRecovery e initm; tcEnv
5145+
else
5146+
tcEnv
51425147

51435148
//----------------------------------------------------------------------------
51445149
// Fault injection
@@ -5375,7 +5380,7 @@ let TypeCheckSingleInputAndFinishEventually(checkForErrors, tcConfig: TcConfig,
53755380
return TypeCheckMultipleInputsFinish([results],tcState)
53765381
}
53775382

5378-
let TypeCheckClosedInputSetFinish (mimpls, tcState) =
5383+
let TypeCheckClosedInputSetFinish (declaredImpls: TypedImplFile list, tcState) =
53795384
// Publish the latest contents to the CCU
53805385
tcState.tcsCcu.Deref.Contents <- tcState.tcsCcuType
53815386

@@ -5385,12 +5390,11 @@ let TypeCheckClosedInputSetFinish (mimpls, tcState) =
53855390
if not (Zset.contains qualNameOfFile rootImpls) then
53865391
errorR(Error(FSComp.SR.buildSignatureWithoutImplementation(qualNameOfFile.Text), qualNameOfFile.Range)))
53875392

5388-
let tassembly = TAssembly(mimpls)
5389-
tcState, tassembly
5393+
tcState, declaredImpls
53905394

53915395
let TypeCheckClosedInputSet (checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, inputs) =
53925396
// tcEnvAtEndOfLastFile is the environment required by fsi.exe when incrementally adding definitions
53935397
let (tcEnvAtEndOfLastFile, topAttrs, mimpls),tcState = TypeCheckMultipleInputs (checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcState, inputs)
5394-
let tcState,tassembly = TypeCheckClosedInputSetFinish (mimpls, tcState)
5395-
tcState, topAttrs, tassembly, tcEnvAtEndOfLastFile
5398+
let tcState, declaredImpls = TypeCheckClosedInputSetFinish (mimpls, tcState)
5399+
tcState, topAttrs, declaredImpls, tcEnvAtEndOfLastFile
53965400

src/fsharp/CompileOps.fsi

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ type TcImports =
602602
member GetCcusExcludingBase : unit -> CcuThunk list
603603
member FindDllInfo : range * string -> ImportedBinary
604604
member TryFindDllInfo : range * string * lookupOnly: bool -> option<ImportedBinary>
605-
member FindCcuFromAssemblyRef : range * ILAssemblyRef -> Tast.CcuResolutionResult
605+
member FindCcuFromAssemblyRef : range * ILAssemblyRef -> CcuResolutionResult
606606
#if EXTENSIONTYPING
607607
member ProviderGeneratedTypeRoots : ProviderGeneratedType list
608608
#endif
@@ -668,8 +668,7 @@ val ProcessMetaCommandsFromInput :
668668
val ApplyMetaCommandsFromInputToTcConfig : TcConfig -> (Ast.ParsedInput * string) -> TcConfig
669669

670670
/// Process the #nowarn in an input
671-
val ApplyNoWarnsToTcConfig : TcConfig -> (Ast.ParsedInput*string) -> TcConfig
672-
671+
val ApplyNoWarnsToTcConfig : TcConfig -> (Ast.ParsedInput * string) -> TcConfig
673672

674673
//----------------------------------------------------------------------------
675674
// Scoped pragmas
@@ -724,23 +723,21 @@ val GetInitialTcState :
724723
/// Check one input, returned as an Eventually computation
725724
val TypeCheckOneInputEventually :
726725
(unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * NameResolution.TcResultsSink * TcState * Ast.ParsedInput
727-
-> Eventually<(TcEnv * TopAttribs * Tast.TypedImplFile list) * TcState>
726+
-> Eventually<(TcEnv * TopAttribs * TypedImplFile list) * TcState>
728727

729728
/// Finish the checking of multiple inputs
730729
val TypeCheckMultipleInputsFinish : (TcEnv * TopAttribs * 'T list) list * TcState -> (TcEnv * TopAttribs * 'T list) * TcState
731730
732731
/// Finish the checking of a closed set of inputs
733-
val TypeCheckClosedInputSetFinish : TypedImplFile list * TcState -> TcState * TypedAssembly
732+
val TypeCheckClosedInputSetFinish : TypedImplFile list * TcState -> TcState * TypedImplFile list
734733

735734
/// Check a closed set of inputs
736-
val TypeCheckClosedInputSet :
737-
(unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * TcState * Ast.ParsedInput list
738-
-> TcState * TopAttribs * Tast.TypedAssembly * TcEnv
735+
val TypeCheckClosedInputSet :(unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * TcState * Ast.ParsedInput list -> TcState * TopAttribs * TypedImplFile list * TcEnv
739736

740737
/// Check a single input and finish the checking
741738
val TypeCheckSingleInputAndFinishEventually :
742739
(unit -> bool) * TcConfig * TcImports * TcGlobals * Ast.LongIdent option * NameResolution.TcResultsSink * TcState * Ast.ParsedInput
743-
-> Eventually<(TcEnv * TopAttribs * Tast.TypedImplFile list) * TcState>
740+
-> Eventually<(TcEnv * TopAttribs * TypedImplFile list) * TcState>
744741

745742
/// Indicates if we should report a warning
746743
val ReportWarning : globalWarnLevel: int * specificWarnOff: int list * specificWarnOn: int list -> PhasedError -> bool

0 commit comments

Comments
 (0)