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

Internal FCS error is shown on SRTP pattern for struct tuple #6062

Closed
Liminiens opened this issue Jan 4, 2019 · 4 comments
Closed

Internal FCS error is shown on SRTP pattern for struct tuple #6062

Liminiens opened this issue Jan 4, 2019 · 4 comments
Milestone

Comments

@Liminiens
Copy link

Liminiens commented Jan 4, 2019

Repro steps

  1. Write this code
let inline test (arg: ^T when ^T : struct) = 
    (^T : (member Item1: _) (arg))

[<EntryPoint>]
let main argv =
    let a = test struct (1, 2)
    0 // return an integer exit code

Expected behavior

Pattern works as ValueTuple has Item1 (?)

Actual behavior

FS0192	internal error: tcrefOfAppTy
FS0073	internal error: tcrefOfAppTy (Failure)
FS0073	internal error: tcrefOfAppTy (Failure)
FS0073	internal error: tcrefOfAppTy (Failure)
FS0073	internal error: tcrefOfAppTy (Failure)
FS0073	internal error: tcrefOfAppTy (Failure)

Related information

.NET Core SDK 2.2.101

@cartermp
Copy link
Contributor

cartermp commented Jan 4, 2019

There is no current ability to use ItemX properties on struct tuples. There is an approved RFC out to do this here: https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1064-struct-tuple-equivalence.md

We'd certainly welcome the PR, but I don't think it's a priority for us given that pattern matching/deconstruction is the idiomatic way to work with tuples in F#.

That said, I'm labeling this as a regression since the error message did appear to not be an internal error at one point:

/Users/phillip/scratch/bar/Program.fs(54,13): error FS0001: A generic construct requires that the type 'struct ('a * 'b)' is a CLI or F# struct type

Though what it really should be saying is that struct (1, 2) does not support Item1 as a property

@auduchinok
Copy link
Member

Just to add a bit of context: the initial issue mentions it's happening in Rider 2018.3.1 that uses FCS built from dev15.9 branch (with few additional patches) so the regression seems to not have appeared after recent changes in master.

@TIHan
Copy link
Contributor

TIHan commented Jan 10, 2019

Edit: Yes, we should not get an internal error.

@TIHan
Copy link
Contributor

TIHan commented Jan 11, 2019

Closing issue as we have resolved the internal error and now receive a proper error. Also fixes struct tuples and struct constraints in general.

@TIHan TIHan closed this as completed Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants