Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS0193 internal error when defining two types and putting their values into a Result in one send to FSI #13107

Closed
theprash opened this issue May 6, 2022 · 1 comment
Labels

Comments

@theprash
Copy link

theprash commented May 6, 2022

This was originally discovered on the F# Forums in a larger code sample.

❌ Defining 2 types and putting them both inside Result.Ok and sending all the code to FSI at once results in an error:

Microsoft (R) F# Interactive version 12.0.1.0 for F# 6.0 
Copyright (c) Microsoft Corporation. All Rights Reserved.

> type A = A
- type B = B
- let x : Result<_, unit> = Ok (A, B);;

error FS0193: internal error: Could not load type 'B' from assembly 'FSI-ASSEMBLY, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

Code:

type A = A
type B = B
let x : Result<_, unit> = Ok (A, B);;

❌ Putting the values into the Error case fails with the same error:

type A = A
type B = B
let x : Result<unit, _> = Error (A, B);;

❌ Using an anonymous record instead of a tuple inside the result give the same error:

type A = A
type B = B
let x : Result<_, unit> = Ok {| A = A; B = B |}

✔ Using a Choice1of2 instead of Result works fine:

type A = A
type B = B
let x : Choice<_, unit> = Choice1Of2 (A, B)

✔ If you send the first two lines to FSI in one step, and then send the last line to FSI as a second step, there is no error.

Expected behavior

All of the above code samples should compile and run without error.

Known workarounds

Sending the code to FSI in smaller, separate chunks.

Related information

Provide any related information (optional):

  • Windows 10
  • F# Interactive version 12.0.1.0 for F# 6.0
  • Tested in VS 2022 and VS Code
@theprash theprash added the Bug label May 6, 2022
@dsyme
Copy link
Contributor

dsyme commented May 23, 2022

My understanding all these have been fixed by #5457 - that is, using multi-assembly emit with the ilwrite binary writer fixes these problems.

@dsyme dsyme closed this as completed May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants