Skip to content
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

[MIRROR] OpenDream TypeMaker Prep #2301

Merged
merged 1 commit into from
Mar 7, 2024
Merged

[MIRROR] OpenDream TypeMaker Prep #2301

merged 1 commit into from
Mar 7, 2024

Conversation

Steals-The-PRs
Copy link
Collaborator

Mirrored on Nova: NovaSector/NovaSector#1292
Original PR: tgstation/tgstation#81830

About The Pull Request

OpenDream is adding support for proc and var typechecking using as in OpenDreamProject/OpenDream#1705

BYOND silently ignores most uses of as, but OpenDream can leverage it for static typing.

E.g. the following code will error in OpenDream while doing nothing in BYOND:

/datum/proc/meep() as text
    return "meep"

/datum/foobar/meep()
    return 5

Warning OD2701 at code.dm:29:8: /datum/foobar/meep(): Invalid return type "num", expected "text"

Pragmas allow these type emissions to be warnings, errors, or suppressed entirely.

This PR modifies some existing uses of as in TG to prevent ImplicitNullType warnings (which is when a var with a null value doesn't explicitly have the |null type specified). This specific pragma is a bit opinionated so it could simply be disabled, but since this has no impact on BYOND behavior I don't see a reason not to fix these examples anyways.

Why It's Good For The Game

Typechecking.

Changelog

no cl no fun

* OpenDream TypeMaker Prep (#81830)

## About The Pull Request

OpenDream is adding support for proc and var typechecking using `as` in
OpenDreamProject/OpenDream#1705

BYOND silently ignores most uses of `as`, but OpenDream can leverage it
for static typing.

E.g. the following code will error in OpenDream while doing nothing in
BYOND:
```
/datum/proc/meep() as text
    return "meep"

/datum/foobar/meep()
    return 5
```
`Warning OD2701 at code.dm:29:8: /datum/foobar/meep(): Invalid return
type "num", expected "text"`

Pragmas allow these type emissions to be warnings, errors, or suppressed
entirely.

This PR modifies some existing uses of `as` in TG to prevent
`ImplicitNullType` warnings (which is when a var with a null value
doesn't explicitly have the `|null` type specified). This specific
pragma is a bit opinionated so it could simply be disabled, but since
this has no impact on BYOND behavior I don't see a reason not to fix
these examples anyways.

## Why It's Good For The Game

Typechecking.

## Changelog

no cl no fun

* OpenDream TypeMaker Prep

---------

Co-authored-by: ike709 <[email protected]>
@Iajret Iajret merged commit d4b601f into master Mar 7, 2024
24 checks passed
@Iajret Iajret deleted the upstream-mirror-1292 branch March 7, 2024 10:24
Iajret added a commit that referenced this pull request Mar 8, 2024
Iajret added a commit that referenced this pull request Mar 26, 2024
* Revert "[MIRROR] OpenDream TypeMaker Prep (#2301)"

This reverts commit d4b601f.

* non nova stuff shouldn't be reverted, probably?

* and this too
Iajret pushed a commit that referenced this pull request May 3, 2024
remove duplicate override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants