-
Notifications
You must be signed in to change notification settings - Fork 5
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 compiler warnings and deprecations emitted by latest dmd #10
Merged
Geod24
merged 4 commits into
dcarp:master
from
cschlote:fix-compiler-warnings-and-deprecations-emitted-by-latest-dmd
Mar 30, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
76859ea
Workaround for depractation warning for scope used with toString() me…
cschlote 4c43cd4
Use 'return scope' for appendPrerelease0()
cschlote db84851
Add scope to suffix parameter of compareSuffix
cschlote 7f6fa19
Removed 'nothrow' from differAt() method, because of in contract
cschlote File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,9 +141,9 @@ struct SemVer | |
|
||
string semVer = "%(%s.%)".format(ids); | ||
if (!prerelease.empty) | ||
semVer ~= "-" ~ "%-(%s.%)".format(prerelease); | ||
semVer ~= "-" ~ "%-(%s.%)".format(cast(const char[]) prerelease); | ||
if (!build.empty) | ||
semVer ~= "+" ~ "%-(%s.%)".format(build); | ||
semVer ~= "+" ~ "%-(%s.%)".format(cast(const char[]) build); | ||
return semVer; | ||
} | ||
|
||
|
@@ -185,7 +185,7 @@ struct SemVer | |
return result; | ||
} | ||
|
||
private SemVer appendPrerelease0() scope @safe pure nothrow | ||
private SemVer appendPrerelease0() return scope @safe pure nothrow | ||
{ | ||
if (prerelease.empty) | ||
prerelease ~= "0"; | ||
|
@@ -311,7 +311,7 @@ struct SemVer | |
return ids[i] < other.ids[i] ? -1 : 1; | ||
} | ||
|
||
int compareSufix(const string[] suffix, const string[] anotherSuffix) @safe pure | ||
int compareSufix(scope const string[] suffix, const string[] anotherSuffix) @safe pure | ||
{ | ||
import std.conv : to; | ||
import std.string : isNumeric; | ||
|
@@ -372,7 +372,7 @@ struct SemVer | |
/** | ||
* Compare two $(B different) versions and return the parte they differ on. | ||
*/ | ||
VersionPart differAt(ref const SemVer other) const scope @safe pure nothrow | ||
VersionPart differAt(ref const SemVer other) const scope @safe pure | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the error message, it's obvious what is wrong: |
||
in | ||
{ | ||
assert(this != other); | ||
|
@@ -395,7 +395,7 @@ struct SemVer | |
} | ||
|
||
/// ditto | ||
VersionPart differAt(const SemVer other) const scope @safe pure nothrow | ||
VersionPart differAt(const SemVer other) const scope @safe pure | ||
{ | ||
return this.differAt(other); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Okay, with the error message I see the issue.
std.format
is not accepting its parameter byscope
.So casting the
scope
away is indeed the "best" solution here, becausescope
ontoString
is the right thing. The problem is instd.format
.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.
Ok. So format() needs to be changed as the real fix?
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.
Maybe. That's where DIP1000 shows its limitations. If you change format to accept its parameter by
scope
, you will break users that have non-scope
toString
implementations. That includes classes. Oops.