@@ -130,14 +130,6 @@ type FsEnt(ent: FSharpEntity) =
130130 static member IsPublic ( ent : FSharpEntity ) =
131131 not ent.Accessibility.IsPrivate
132132
133- static member QualifiedName ( ent : FSharpEntity ): string =
134- let ent = Helpers.nonAbbreviatedDefinition ent
135- match tryArrayFullName ent with
136- | Some fullName -> fullName
137- | None ->
138- try ent.QualifiedName
139- with _ -> ent.LogicalName
140-
141133 static member FullName ( ent : FSharpEntity ): string =
142134 let ent = Helpers.nonAbbreviatedDefinition ent
143135 match tryArrayFullName ent with
@@ -152,16 +144,16 @@ type FsEnt(ent: FSharpEntity) =
152144 | None -> ent.LogicalName
153145
154146 static member Ref ( ent : FSharpEntity ): Fable.EntityRef =
155- let sourcePath =
156- if Option.isSome ent.Assembly.FileName
157- then None
158- else Some ( FsEnt.SourcePath ent )
159- { QualifiedName = FsEnt.QualifiedName ent
160- SourcePath = sourcePath }
161-
162- static member Ref ( assemblyEntityQualifiedName : string ): Fable.EntityRef =
163- { QualifiedName = assemblyEntityQualifiedName
164- SourcePath = None }
147+ let path =
148+ match ent.Assembly.FileName with
149+ // When compiling with netcoreapp target, netstandard only contains redirects
150+ // Find the actual assembly name from the entity qualified name
151+ | Some asmPath when asmPath.EndsWith ( " netstandard.dll " ) ->
152+ ent.QualifiedName.Split ( ',' ).[ 1 ]. Trim () |> Fable.CoreAssemblyName
153+ | Some asmPath -> Path.normalizePath asmPath |> Fable.AssemblyPath
154+ | None -> FsEnt.SourcePath ent |> Fable.SourcePath
155+ { FullName = FsEnt.FullName ent
156+ Path = path }
165157
166158 interface Fable.Entity with
167159 member _.Ref = FsEnt.Ref ent
@@ -775,11 +767,11 @@ module TypeHelpers =
775767 dict [ " bool`1" , Choice1Of2 Fable.Boolean
776768 " byte`1" , Choice1Of2 ( Fable.Number UInt8)
777769 " string`1" , Choice1Of2 Fable.String
778- " uint64`1" , Choice2Of2 Types.uint64
779- " Guid`1" , Choice2Of2 Types.guid
780- " TimeSpan`1" , Choice2Of2 Types.timespan
781- " DateTime`1" , Choice2Of2 Types.datetime
782- " DateTimeOffset`1" , Choice2Of2 Types.datetimeOffset]
770+ " uint64`1" , Choice2Of2( " System.Runtime " , Types.uint64)
771+ " Guid`1" , Choice2Of2( " System.Runtime " , Types.guid)
772+ " TimeSpan`1" , Choice2Of2( " System.Runtime " , Types.timespan)
773+ " DateTime`1" , Choice2Of2( " System.Runtime " , Types.datetime)
774+ " DateTimeOffset`1" , Choice2Of2( " System.Runtime " , Types.datetimeOffset) ]
783775
784776 let makeTypeFromDef ctxTypeArgs ( genArgs : IList < FSharpType >) ( tdef : FSharpEntity ) =
785777 if tdef.IsArrayType then
@@ -808,7 +800,11 @@ module TypeHelpers =
808800 | Naming.StartsWith " FSharp.UMX." ( DicContains fsharpUMX choice) ->
809801 match choice with
810802 | Choice1Of2 t -> t
811- | Choice2Of2 qualifiedName -> Fable.DeclaredType( FsEnt.Ref qualifiedName, [])
803+ | Choice2Of2( dllName, fullName) ->
804+ let r : Fable.EntityRef =
805+ { FullName = fullName
806+ Path = Fable.CoreAssemblyName dllName }
807+ Fable.DeclaredType( r, [])
812808 | _ ->
813809 // Special attributes
814810 tdef.Attributes |> tryPickAttribute [
@@ -857,7 +853,7 @@ module TypeHelpers =
857853 | _ -> ()
858854 }
859855
860- let getArgTypes com ( memb : FSharpMemberOrFunctionOrValue ) =
856+ let getArgTypes _com ( memb : FSharpMemberOrFunctionOrValue ) =
861857 // FSharpParameters don't contain the `this` arg
862858 Seq.concat memb.CurriedParameterGroups
863859 // The F# compiler "untuples" the args in methods
@@ -878,7 +874,7 @@ module TypeHelpers =
878874 if t.HasTypeDefinition then Some t.TypeDefinition else None
879875 else None
880876
881- let tryFindMember com ( entity : Fable.Entity ) genArgs compiledName isInstance ( argTypes : Fable.Type list ) =
877+ let tryFindMember _com ( entity : Fable.Entity ) genArgs compiledName isInstance ( argTypes : Fable.Type list ) =
882878 let argsEqual ( args1 : Fable.Type list ) args1Length ( args2 : IList < IList < FSharpParameter >>) =
883879 let args2Length = args2 |> Seq.sumBy ( fun g -> g.Count)
884880 if args1Length = args2Length then
@@ -898,7 +894,7 @@ module TypeHelpers =
898894 else false )
899895 | _ -> None
900896
901- let fitsAnonRecordInInterface com ( argExprs : Fable.Expr list ) fieldNames ( interface_ : Fable.Entity ) =
897+ let fitsAnonRecordInInterface _com ( argExprs : Fable.Expr list ) fieldNames ( interface_ : Fable.Entity ) =
902898 match interface_ with
903899 | :? FsEnt as fsEnt ->
904900 let interface_ = fsEnt.FSharpEntity
@@ -931,7 +927,7 @@ module TypeHelpers =
931927
932928
933929
934- let inline (| FableType |) com ( ctx : Context ) t = makeType ctx.GenericArgs t
930+ let inline (| FableType |) _com ( ctx : Context ) t = makeType ctx.GenericArgs t
935931
936932module Identifiers =
937933 open Helpers
@@ -940,7 +936,7 @@ module Identifiers =
940936 let putIdentInScope ( ctx : Context ) ( fsRef : FSharpMemberOrFunctionOrValue ) ( ident : Fable.Ident ) value =
941937 { ctx with Scope = ( fsRef, ident, value):: ctx.Scope}
942938
943- let makeIdentFrom ( com : IFableCompiler ) ( ctx : Context ) ( fsRef : FSharpMemberOrFunctionOrValue ): Fable.Ident =
939+ let makeIdentFrom ( _com : IFableCompiler ) ( ctx : Context ) ( fsRef : FSharpMemberOrFunctionOrValue ): Fable.Ident =
944940 let sanitizedName = ( fsRef.CompiledName, Naming.NoMemberPart)
945941 ||> Naming.sanitizeIdent ( isUsedName ctx)
946942 ctx.UseNamesInDeclarationScope.Add( sanitizedName) |> ignore
@@ -1153,7 +1149,9 @@ module Util =
11531149 | _ -> false )
11541150
11551151 let isFromDllRef ( ent : Fable.Entity ) =
1156- Option.isNone ent.Ref.SourcePath
1152+ match ent.Ref.Path with
1153+ | Fable.AssemblyPath _ | Fable.CoreAssemblyName _ -> true
1154+ | Fable.SourcePath _ -> false
11571155
11581156 let private isReplacementCandidatePrivate isFromDllRef ( entFullName : string ) =
11591157 if entFullName.StartsWith( " System." ) || entFullName.StartsWith( " Microsoft.FSharp." ) then isFromDllRef
@@ -1162,8 +1160,7 @@ module Util =
11621160 else entFullName.StartsWith( " Fable.Core." )
11631161
11641162 let isReplacementCandidate ( ent : Fable.Entity ) =
1165- let isFromDllRef = Option.isNone ent.Ref.SourcePath
1166- isReplacementCandidatePrivate isFromDllRef ent.FullName
1163+ isReplacementCandidatePrivate ( isFromDllRef ent) ent.FullName
11671164
11681165 let isReplacementCandidateFrom ( ent : FSharpEntity ) =
11691166 let isFromDllRef = Option.isSome ent.Assembly.FileName
@@ -1272,7 +1269,7 @@ module Util =
12721269 let entityName = defaultArg ent.TryFullName " "
12731270 entityName + " ." + memberName + overloadHash
12741271
1275- let callInstanceMember com r typ ( callInfo : Fable.CallInfo )
1272+ let callInstanceMember _com r typ ( callInfo : Fable.CallInfo )
12761273 ( entity : FSharpEntity ) ( memb : FSharpMemberOrFunctionOrValue ) =
12771274 let callInfo , callee =
12781275 match callInfo.ThisArg with
@@ -1455,7 +1452,7 @@ module Util =
14551452 if List.isEmpty args then importExpr
14561453 else makeCall r t info importExpr
14571454 | body ->
1458- List.fold ( fun body binding -> Fable.Let([ binding ] , body)) body bindings
1455+ List.fold ( fun body ( ident , value ) -> Fable.Let( ident , value , body)) body bindings
14591456
14601457 let (| Inlined | _ |) ( com : IFableCompiler ) ctx r t genArgs callee info ( memb : FSharpMemberOrFunctionOrValue ) =
14611458 if isInline memb
0 commit comments