Skip to content

System.Tuple aliasing works only half-way #3016

Closed
@fsoikin

Description

@fsoikin

The System.Tuple.Create methods are specially processed, so that their return types are considered "true" F# tuples, but the types System.Tuple<...> are not similarly aliased to "true" F# tuples. This leads to the following peculiar situation:

image

Repro steps

let x: System.Tuple<int,int> = System.Tuple.Create(1,2)

Expected behavior

The code should compile without error.

Actual behavior

Error: FS0001 This expression was expected to have type 'System.Tuple<int,int>' but here has type ''a * 'b'

Known workarounds

  1. Omit type declaration: let x = System.Tuple.Create(1,2).
  2. Declare type as int * int instead of Tuple<int,int>.
  3. Create the tuple by calling the constructor: let x: Tuple<int, int> = Tuple<_, _>( 1, 2 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.Ready

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions