You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7245 Reporter: william Assigned to:@gasche Status: resolved (set by @mshinwell on 2016-09-08T09:19:12Z) Resolution: fixed Priority: low Severity: minor Target version: 4.04.0 +dev / +beta1 / +beta2 Category: documentation Monitored by:@hcarty
Bug description
It would be nice to replace "52 Fragile constant pattern" by "52 Fragile constant pattern (see detailed section below)"
Also, I would replace the following explanations :
"If your code raises this warning, you should not change the way you test for the specific string to avoid the warning (for example using a string equality inside the right-hand-side instead of a literal pattern), as your code would remain fragile. You should instead enlarge the scope of the pattern by matching on all possible values. This may require some care: if the scrutinee may return several different cases of the same pattern, or raise distinct instances of the same exception, you may need to modify your code to separate those several cases."
By this :
If your code raises this warning, you should not change the way you test for the specific string to avoid the warning (for example using a string equality inside the right-hand-side instead of a literal pattern), as your code would remain fragile. You should instead enlarge the scope of the pattern by matching on all possible values, such as in this example :
let warning = function
| Foo _ -> 0
| _ -> 1
This may require some care: if the scrutinee may return several different cases of the same pattern, or raise distinct instances of the same exception, you may need to modify your code to separate those several cases. For example [...]
The text was updated successfully, but these errors were encountered:
Original bug ID: 7245
Reporter: william
Assigned to: @gasche
Status: resolved (set by @mshinwell on 2016-09-08T09:19:12Z)
Resolution: fixed
Priority: low
Severity: minor
Target version: 4.04.0 +dev / +beta1 / +beta2
Category: documentation
Monitored by: @hcarty
Bug description
It would be nice to replace "52 Fragile constant pattern" by "52 Fragile constant pattern (see detailed section below)"
Also, I would replace the following explanations :
"If your code raises this warning, you should not change the way you test for the specific string to avoid the warning (for example using a string equality inside the right-hand-side instead of a literal pattern), as your code would remain fragile. You should instead enlarge the scope of the pattern by matching on all possible values. This may require some care: if the scrutinee may return several different cases of the same pattern, or raise distinct instances of the same exception, you may need to modify your code to separate those several cases."
By this :
If your code raises this warning, you should not change the way you test for the specific string to avoid the warning (for example using a string equality inside the right-hand-side instead of a literal pattern), as your code would remain fragile. You should instead enlarge the scope of the pattern by matching on all possible values, such as in this example :
let warning = function
| Foo _ -> 0
| _ -> 1
This may require some care: if the scrutinee may return several different cases of the same pattern, or raise distinct instances of the same exception, you may need to modify your code to separate those several cases. For example [...]
The text was updated successfully, but these errors were encountered: