-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: Fixed a bug where double ? would be generated for stubs #103
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
=======================================
Coverage 99.28% 99.29%
=======================================
Files 22 22
Lines 2253 2269 +16
=======================================
+ Hits 2237 2253 +16
Misses 16 16 ☔ View full report in Codecov by Sentry. |
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.
This does not fully fix the issue. Literal["Test"] | None
gets translated to literal<"Test">?
for example. The ?
syntax for nullability is only supported for named Safe-DS types (class types/enum types/enum variant types/type parameter types). Out of those, you probably only generate class types.
For this literal type, you could create literal<"Test", null>
instead. For everything else, you need the union
with Nothing?
.
# Conflicts: # tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[type_var_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[type_var_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
Outdated
Show resolved
Hide resolved
...ots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
Outdated
Show resolved
Hide resolved
… get a "?" if they are in a Union with a None type; Nones are pushed to the end of Unions; None types are shown as "null" in LiteralTypes and "null" is added to LiteralTypes if they are in a Union with a None.
I hope everything is all right now |
# Conflicts: # tests/data/various_modules_package/function_module.py # tests/safeds_stubgen/api_analyzer/__snapshots__/test__get_api.ambr # tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[function_module].sdsstub
…to 87-double-in-generated-types
Looks good now, I'll review it tomorrow evening if the conflicts are resolved. |
# Conflicts: # tests/safeds_stubgen/stubs_generator/__snapshots__/test_generate_stubs/TestStubFileGeneration.test_stub_creation[infer_types_module].sdsstub
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.
👍
## [0.3.0](v0.2.0...v0.3.0) (2024-05-04) ### Features * Added handling for sequence classes ([#127](#127)) ([cb061ab](cb061ab)), closes [#126](#126) * DocString result names for Safe-DS stub results ([#101](#101)) ([fe163e3](fe163e3)), closes [#100](#100) * Examples from docstrings are also taken over to stub docstrings ([#116](#116)) ([6665186](6665186)), closes [#115](#115) * Replace the docstring_parser library with Griffe ([#79](#79)) ([9b2f802](9b2f802)) ### Bug Fixes * `Self` types as results are translated to class names ([#110](#110)) ([4554a56](4554a56)), closes [#86](#86) * Creating stubs with relative paths for source and output directories ([#128](#128)) ([b4493c9](b4493c9)), closes [#125](#125) * Docstrings have the correct indentation for nested classes (stubs) ([#114](#114)) ([c7b8550](c7b8550)), closes [#113](#113) * Fixed a bug where double ? would be generated for stubs ([#103](#103)) ([c35c6ac](c35c6ac)), closes [#87](#87) [#87](#87) * Fixed a bug where imports would not check reexports for shortest path ([#112](#112)) ([48c5367](48c5367)), closes [#82](#82) * Fixed a bug where results in stubs would not be named ([#131](#131)) ([4408c84](4408c84)), closes [#100](#100) * Fixed a bug which prevented mypy version update ([#107](#107)) ([501d2cd](501d2cd)) * Fixed the stubs generator ([#108](#108)) ([9ad6df6](9ad6df6)), closes [#80](#80) * Generated names of callback results start with result, not with param ([#104](#104)) ([6e696e9](6e696e9)), closes [#85](#85) * Include lines of examples that start with `...` ([#130](#130)) ([3477b4a](3477b4a)), closes [#129](#129) * No "// TODO ..." if return type is explicitly `None` ([#111](#111)) ([08e345f](08e345f)), closes [#83](#83) * Removed the Epydoc parser ([#89](#89)) ([684a101](684a101)) * Replaced tabs with 4 spaces ([#105](#105)) ([8e7aa5d](8e7aa5d)), closes [#84](#84) * The file structure of stubs resembles the "package" path. ([#106](#106)) ([ff1800e](ff1800e)), closes [#81](#81) * Translation of callable ([#102](#102)) ([c581e6a](c581e6a)), closes [#88](#88) [#88](#88)
🎉 This PR is included in version 0.3.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Closes #87
Summary of Changes
Fixed the bug described in #87.