-
Notifications
You must be signed in to change notification settings - Fork 311
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
[JS/TS] add tests for nullness supports #4070
Conversation
[JS/TS] Add support for `Unchecked.nonNull`
Off the top of my head, adding nullness to input parameters of some Fable.Core functions. More often than not it will be changing
There's a LOT more, but the functions can be easily adjusted on demand later. The only downside is the signature in Fable.Core has to be hidden behind |
The problem is, as far as I can see F# does not respect |
Here, I think you are not speaking about nullness support directly but more shaping Fable.Core API to takes advantages of nullness. Fable.Core is a pure binding, meaning that it is served as a We will need to check if nullness information are backward compatible in general. But if we move to use
You are right neither the warning or error is reported by Fable right now. I will take a look why we don't get the diagnostics (perhaps we are not ignoring it or not passing the configuration to FCS). |
It is, so if Fable.Core is not distributed in source form, we don't need directives. |
Nullness warnings are now reported. Supporting
This is because Fable recreate a "single project" using the user project and dependencies. So when enabling, |
It seems like when we enable nullness F# generates errors in certain situation when a constraint don't have the Below is the output of using Fable with I suspect this is because Fable compile the sources files of the packages where in a normal situation F# just consume the This seems to show that in order to support nullness in Fable ecosystem, we will need to update all the libraries to use compatible Hopefully, if a code use |
Damn, that's a good point - we're compiling every library in a null-aware context.
Only with Fable 5 :/ Sadly, I don't think there's a way around this, and we'll just need to go update these projects. |
Oh because otherwise, it will generate a syntax error right? Unless, the library author use This is unfortunate that this is causing issues in both direction... |
If we wanted to avoid this problem, we would probably have to explore the idea of compiling the libraries and the main project in 2 separates projects. Like mentioned here I think we could have what is is needed to do that now, because Fable has the ability to use Note: I believe I found a solution to support |
Fix #3887
Fix #3991
@kerams
It seems like Fable already supports "nullness" and its new API thanks to @ncave adding the new
NonNull
,Null
, APIs.I tried to create some tests suites to check if "nullness" is working but I think that right now this is more testing if
T | null
and related APIs works with Fable.I am not sure if we want to enable on the test project
<Nullable>enable</Nullable>
, this generates several new warnings and I am not sure if this adds value for this specific project.Example of places with warnings:
If we thinks that enabling nullable make sense, I can give a try to fix them.
I am not familiar with nullness API, @kerams do you see a common case that is not covered and you would like to be covered? I tried to look at F# repository for tests regarding but it seems like most of them are related to testing compiler warning.