Skip to content

Commit c3cd85d

Browse files
committed
No inlining for FSharp.Core
1 parent 7579cf0 commit c3cd85d

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

fcs/fcs-fable/test/Platform.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module Fable.Compiler.Platform
22

3-
let __dirname = "."
4-
53
#if DOTNET_FILE_SYSTEM && !FABLE_COMPILER
64

75
open System.IO

fcs/fcs-fable/test/ProjectParser.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ let parseProjectFile projectPath =
112112
|> Seq.toArray
113113

114114
// replace some variables
115-
let projectText = projectText.Replace(@"$(MSBuildProjectDirectory)", __dirname)
115+
let projectText = projectText.Replace(@"$(MSBuildProjectDirectory)", ".")
116116
let m = Regex.Match(projectText, @"<FSharpSourcesRoot[^>]*>([^<]*)<\/FSharpSourcesRoot[^>]*>")
117117
let sourcesRoot = if m.Success then m.Groups.[1].Value.Replace("\\", "/") else ""
118118
let projectText = projectText.Replace(@"$(FSharpSourcesRoot)", sourcesRoot)

src/fsharp/Optimizer.fs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,11 @@ let TryGetInfoForNonLocalEntityRef env (nleref: NonLocalEntityRef) =
552552
let GetInfoForNonLocalVal cenv env (vref:ValRef) =
553553
if vref.IsDispatchSlot then
554554
UnknownValInfo
555+
#if FABLE_COMPILER
556+
// no inlining for FSharp.Core
557+
elif vref.ToString().Contains("FSharp.Core.") then
558+
UnknownValInfo
559+
#endif
555560
// REVIEW: optionally turn x-module on/off on per-module basis or
556561
elif cenv.settings.crossModuleOpt () || vref.MustInline then
557562
match TryGetInfoForNonLocalEntityRef env vref.nlr.EnclosingEntity.nlr with
@@ -2425,7 +2430,12 @@ and OptimizeVal cenv env expr (v:ValRef, m) =
24252430
e, AddValEqualityInfo cenv.g m v einfo
24262431

24272432
| None ->
2428-
if v.MustInline then error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
2433+
if v.MustInline
2434+
#if FABLE_COMPILER
2435+
// no inlining for FSharp.Core
2436+
&& not (v.ToString().Contains("FSharp.Core."))
2437+
#endif
2438+
then error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m))
24292439
expr, (AddValEqualityInfo cenv.g m v
24302440
{ Info=valInfoForVal.ValExprInfo
24312441
HasEffect=false

0 commit comments

Comments
 (0)