-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Clone() implemented improperly for MatchString.cs? #3994
Copy link
Copy link
Closed
Labels
Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalitythe issue is for cleaning up the code with no impact on functionalityResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Metadata
Metadata
Assignees
Labels
Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalitythe issue is for cleaning up the code with no impact on functionalityResolution-FixedThe issue is fixed.The issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module
Type
Fields
Give feedbackNo fields configured for issues without a type.
It looks like the Clone functions in MatchString.cs often reference the clone when they meant to reference "this" (explicitly or implicitly). For example, https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.Commands.Utility/commands/utility/MatchString.cs#L65 checks the newly-created object to see if it has a PreContext, when it probably should check the current object.
It looks like this mistake occurs in both Clone() functions.
Also, where is the definition of the Match class?