-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement unused (renamed to ghost terms) #3342
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4b81aae
Implement unused values
nicolasstucki ea4c483
Transform unused arguments to dummy values in typer
nicolasstucki cf52f93
Re-enable unused vals and defs
nicolasstucki 85f9a70
Move NoInit checks to Mixin
nicolasstucki 5e774d7
Add modifier to NonEmptyFunction and replace ImplicitFunction
nicolasstucki 68ea63c
Document UnusedFunctionN and UnusedImplicitFunctionN
nicolasstucki 7474ba3
Reformat code of UnusedFunctions in NameOpts
nicolasstucki e755dd8
Remove unnecessary early removal of unused prameters
nicolasstucki 2177da5
Move error for unused case accessors
nicolasstucki 724bf9c
Improve error message
nicolasstucki f1aa9fc
Remove unnecessary removal of unused accessors
nicolasstucki ae8f80e
Remove Nothing restriction on unused parameters
nicolasstucki 81ec565
Change error message
nicolasstucki dd661dd
Remove special case for unused closure
nicolasstucki 6a40b84
Keep stable unused arguments
nicolasstucki aa53182
Add documentation
nicolasstucki aba82ba
Complete doc of FunArgMods
nicolasstucki 7c4662d
Use set for funArgMods
nicolasstucki ce2d805
Add missing syntax for FunArgMods
nicolasstucki 544c8d5
Improve variable names
nicolasstucki f10f2d0
Improve comment
nicolasstucki ddf5b2c
Fix synthetic methods of value class with unused params
nicolasstucki 7f81bc3
Make Unused flag a term flag only
nicolasstucki c877473
Add rules
nicolasstucki ed50958
Fix documentation
nicolasstucki c040798
Move methods from UnusedUtil to Applications
nicolasstucki 68afbcd
Update unused parameter doc
nicolasstucki 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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -93,4 +93,5 @@ object Mode { | |
|
||
/** We are in the IDE */ | ||
val Interactive = newMode(20, "Interactive") | ||
|
||
} |
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 |
---|---|---|
|
@@ -174,31 +174,53 @@ object NameOps { | |
*/ | ||
def functionArity: Int = | ||
functionArityFor(str.Function) max { | ||
val n = functionArityFor(str.ImplicitFunction) | ||
val n = | ||
functionArityFor(str.ImplicitFunction) max | ||
functionArityFor(str.UnusedFunction) max | ||
functionArityFor(str.UnusedImplicitFunction) | ||
if (n == 0) -1 else n | ||
} | ||
|
||
/** Is a function name | ||
* - FunctionN for N >= 0 | ||
* - ImplicitFunctionN for N >= 1 | ||
* - UnusedFunctionN for N >= 1 | ||
* - UnusedImplicitFunctionN for N >= 1 | ||
* - false otherwise | ||
*/ | ||
def isFunction: Boolean = functionArity >= 0 | ||
|
||
/** Is a implicit function name | ||
* - ImplicitFunctionN for N >= 1 | ||
* - UnusedImplicitFunctionN for N >= 1 | ||
* - false otherwise | ||
*/ | ||
def isImplicitFunction: Boolean = functionArityFor(str.ImplicitFunction) >= 1 | ||
def isImplicitFunction: Boolean = { | ||
functionArityFor(str.ImplicitFunction) >= 1 || | ||
functionArityFor(str.UnusedImplicitFunction) >= 1 | ||
} | ||
|
||
/** Is a implicit function name | ||
* - UnusedFunctionN for N >= 1 | ||
* - UnusedImplicitFunctionN for N >= 1 | ||
* - false otherwise | ||
*/ | ||
def isUnusedFunction: Boolean = { | ||
functionArityFor(str.UnusedFunction) >= 1 || | ||
functionArityFor(str.UnusedImplicitFunction) >= 1 | ||
} | ||
|
||
/** Is a synthetic function name | ||
* - FunctionN for N > 22 | ||
* - ImplicitFunctionN for N >= 1 | ||
* - UnusedFunctionN for N >= 1 | ||
* - UnusedImplicitFunctionN for N >= 1 | ||
* - false otherwise | ||
*/ | ||
def isSyntheticFunction: Boolean = { | ||
functionArityFor(str.Function) > MaxImplementedFunctionArity || | ||
functionArityFor(str.ImplicitFunction) >= 1 | ||
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. Replace with 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. Better functionArityFor(str.Function) > MaxImplementedFunctionArity ||
functionArityFor(str.ImplicitFunction) >= 1 ||
isUnusedFunction to avoid checking |
||
functionArityFor(str.ImplicitFunction) >= 1 || | ||
isUnusedFunction | ||
} | ||
|
||
/** Parsed function arity for function with some specific prefix */ | ||
|
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
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
Oops, something went wrong.
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.
I don't understand the logic here (and suspect it might be wrong).
Would be good to document this.
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.
I will add documentation.