type EnvStack0 =
struct
val mem_0: (int64 [])
val mem_1: (int64 [])
val mem_2: int64
new(arg_mem_0, arg_mem_1, arg_mem_2) = {mem_0 = arg_mem_0; mem_1 = arg_mem_1; mem_2 = arg_mem_2}
end
and EnvStack1 =
struct
val mem_0: (int64 [])
val mem_1: (int64 [])
new(arg_mem_0, arg_mem_1) = {mem_0 = arg_mem_0; mem_1 = arg_mem_1}
end
let rec method_17(var_3: EnvStack0): unit = ()
EnvStack1([|0L|],[|0L|])
When I try to run the above in the Repl it gives me: error FS0193: internal error: Could not load type 'EnvStack1' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
The Repl version is 14.0.23413.0 - the one that comes with VS2015.
I've tried compiling it and I do not run into the same error. It also works if I load it in two steps, first the types and then the rest.
This seems to be fixed in master (or perhaps a fix in .NET)
C:\GitHub\dsyme\visualfsharp>release\net40\bin\fsi
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> type EnvStack0 =
- struct
- val mem_0: (int64 [])
- val mem_1: (int64 [])
- val mem_2: int64
- new(arg_mem_0, arg_mem_1, arg_mem_2) = {mem_0 = arg_mem_0; mem_1 = arg_mem_1; mem_2 = arg_mem_2}
- end
- and EnvStack1 =
- struct
- val mem_0: (int64 [])
- val mem_1: (int64 [])
- new(arg_mem_0, arg_mem_1) = {mem_0 = arg_mem_0; mem_1 = arg_mem_1}
- end
-
- let rec method_17(var_3: EnvStack0): unit = ()
-
- EnvStack1([|0L|],[|0L|]);;
type EnvStack0 =
struct
new : arg_mem_0:int64 [] * arg_mem_1:int64 [] * arg_mem_2:int64 ->
EnvStack0
val mem_0: int64 []
val mem_1: int64 []
val mem_2: int64
end
and EnvStack1 =
struct
new : arg_mem_0:int64 [] * arg_mem_1:int64 [] -> EnvStack1
val mem_0: int64 []
val mem_1: int64 []
end
val method_17 : var_3:EnvStack0 -> unit
val it : EnvStack1 = FSI_0002+EnvStack1
> #q;;
@mrakgr, just to clarify @dsyme's comment, he means this is fixed in VS2017. I just tried your example on my installation of VS2017 and I can confirm that it indeed works. I also tried it on VS2015 and there it fails.
You write that you are using VS2015 but I believe that, unless for security issues, no new updates are expected for that platform, anything new (including the already released F# 4.1) will only work with VS2017. To use that code you'll need to upgrade (or find a workaround). Note that you can install VS2015 and VS2017, or even the previews of the latter, side by side.
If you want to continue using VS2015, you can also install the nuget package "FSharp.Compiler.Tools", this will replace the VS compiler with the one contained in that package.
You may need to edit your project file once:
Either replace the large choose block with
<Choose>
<When Condition="'$(VisualStudioVersion)' == '11.0'">
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets') ">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets') ">
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
or just remove it completely. (FSharpTargetsPath is defined by the package itself, so it doesn't need to be defined in the project file anymore)
Most helpful comment
If you want to continue using VS2015, you can also install the nuget package "FSharp.Compiler.Tools", this will replace the VS compiler with the one contained in that package.
You may need to edit your project file once:
Either replace the large choose block with
or just remove it completely. (
FSharpTargetsPathis defined by the package itself, so it doesn't need to be defined in the project file anymore)