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
Better error message when specializing generic abstract type with unit #1377
Better error message when specializing generic abstract type with unit #1377
Conversation
regarding tests: tests\fsharpqa\Source\Warnings\env.lst is now a dumping ground for tests that check error messages. I think it would be ok to add it there |
| _ :: ts -> hasUnitTType_app ts | ||
| [] -> false | ||
|
||
match minfoVirt.EnclosingType with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most similar pattern matches call striptypEqns - maybe @dsyme can tell if it's needed here
thanks @forki, I'll pay a look and try to add few tests supposed to trigger that new message. |
4d557af
to
0d8fb6e
Compare
Mmmh reading details @dsyme left in the ancient conversation and my proposed fix is not really handling things at the level he was intending the changes to happen but later down the road, although it looks simpler (if that doesn't raise false positives), maybe it doesn't follow the normal conventions for deciding of errors, but there are few other conditionals to decide which error message to raise where I've added the logic.
I'm trying to see if other cases would trigger the initial / new error messages, this compiles fine with and without the change: type Foo<'t> =
abstract member Bar : 't -> int
type Bar() =
interface Foo<unit> with
member x.Bar _ = 1 I'll look if fsharpqa also has tests checking no error / warning shows up to add that case. If anyone knows of additional cases I should account for, that would be great. |
f39f356
to
1ea73c0
Compare
@@ -0,0 +1,9 @@ | |||
// #UnitGenericAbstractType | |||
//<Expects status=success></Expects> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not an error (this sintax is supported), but can you pls write that as xml like (supported too)?
//<Expects status="success"></Expects>
i am trying to convert the suite to nunit, and to simplify test spec i'll need to convert that as xml like later (easier to parse, validate)
7046884
to
17ec8ce
Compare
@KevinRansom or @dsyme could we get a review on proposed fix and some direction for the error message? |
@dsyme Kevin |
Thank you for taking care of this Kevin |
Attempt to fix #35
I'll need some guidance in terms of where to add tests and of course if there is anything wrong with the matching I'm doing / assumptions I'm taking.
I'm concerned the matching might yield false positive if there are cases where using
unit
as a generic type argument would be valid, but this is difficult for me to reason about as of now.Also looking for better ideas for the error message.