Skip to content

[FS-1037] Allow Union Constructor to deal with Flexible Type - #4798

Closed
liboz wants to merge 4 commits into
dotnet:dev15.8from
liboz:working2
Closed

liboz wants to merge 4 commits into
dotnet:dev15.8from
liboz:working2

Conversation

@liboz

@liboz liboz commented Apr 27, 2018

Copy link
Copy Markdown
Contributor

@liboz liboz changed the title Working2 [FS-1037] Allow Union Constructor to deal with Flexible Type Apr 27, 2018
@cartermp

Copy link
Copy Markdown
Contributor

Thanks @liboz

@cartermp
cartermp requested review from KevinRansom and dsyme April 30, 2018 17:58
@KevinRansom
KevinRansom changed the base branch from master to dev15.8 May 9, 2018 04:25
@KevinRansom

Copy link
Copy Markdown
Contributor

Targeting 15.8

@dsyme

dsyme commented May 18, 2018 •

Copy link
Copy Markdown
Contributor

@liboz I believe this PR will be subject to the same issue as mentioned in https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1055-subsumption-for-yield-in-sequence-expression.md (#4930), that is some existing code may become more generic. For example

type C = C of System.IComparable

let g3 xs = C (Seq.head xs)

Previously this would give type

val g3 : seq<IComparable> -> C

but will now give

val g3 : seq<#IComparable> -> C

There is some logic in the more general type, and indeed it may be useful. However in the extreme (e.g. with a signature file) it can be considered a breaking change. The fix is the same as for https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1055-subsumption-for-yield-in-sequence-expression.md

I will test this out. Assuming I am I propose to merge this PR with #4930 to allow them to take advantage of the same underlying approach to ensure 100% compatibility, rather than making one dependent on the other

@dsyme dsyme left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above, we will have to make a small additional change here.

@cartermp cartermp added this to the 15.8 milestone May 20, 2018
@liboz

liboz commented May 21, 2018

Copy link
Copy Markdown
Contributor Author

@dsyme Do you need to be do anything to merge it or will you handle that?

@dsyme

dsyme commented May 21, 2018

Copy link
Copy Markdown
Contributor

@liboz I will handle it, I will merge with #4930

@dsyme

dsyme commented May 22, 2018

Copy link
Copy Markdown
Contributor

Merged into #4930

@liboz

liboz commented May 29, 2018 •

Copy link
Copy Markdown
Contributor Author

@dsyme So I pulled the latest from the dev15.8 branch and attempted to try the simple example that led to this PR:

type Foo = Items of seq<int>
[1;2;3] |> Items

However I seem to be getting errors when attempting that. Did I do something wrong or was this not directly merged yet?

@cartermp

Copy link
Copy Markdown
Contributor

cc @brettfo who may know more

@dsyme

dsyme commented May 29, 2018

Copy link
Copy Markdown
Contributor

It looks like I didn't push the commits for the union constructors (RFC FS-1037), they are now in #5030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants