-
Notifications
You must be signed in to change notification settings - Fork 833
Remove List.headAndTail and some tuples #9336
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
Conversation
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.
One small change still needed, otherwise this looks fine to me
| let wrap, h', _readonly, _writeonly = mkExprAddrOfExpr g true false PossiblyMutates h None m | ||
| Some (wrap (Expr.Op (TOp.TraitCall traitInfo, [], (h' :: t), m))) | ||
| if minfo.IsStruct && minfo.IsInstance then | ||
| match argExprs with |
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.
This isn't quite the same, it's missing the [] -> false case.
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.
@cartermp , I believe that case is taken care of in isByRefTy but boolean logic has always been my downfall.
let isByrefTy g ty =
ty |> stripTyEqns g |> (function
| TType_app(tcref, _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref
| TType_app(tcref, _) -> tyconRefEq g g.byref_tcr tcref
| _ -> false)
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 also suffer from boolean logic, which is also why I think it'd be better if the original [] -> false case was restored
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.
@cartermp no the [] case is still there. It's just rearranged
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.
Or maybe more correct: one of the two tests for [] is still in place
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.
It is, I see it now, I was always hopeless at where's waldo.
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.
aha, I think I see it now too. The original code was so hard to read
| let wrap, h', _readonly, _writeonly = mkExprAddrOfExpr g true false PossiblyMutates h None m | ||
| Some (wrap (Expr.Op (TOp.TraitCall traitInfo, [], (h' :: t), m))) | ||
| if minfo.IsStruct && minfo.IsInstance then | ||
| match argExprs with |
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.
@cartermp , I believe that case is taken care of in isByRefTy but boolean logic has always been my downfall.
let isByrefTy g ty =
ty |> stripTyEqns g |> (function
| TType_app(tcref, _) when g.byref2_tcr.CanDeref -> tyconRefEq g g.byref2_tcr tcref
| TType_app(tcref, _) -> tyconRefEq g g.byref_tcr tcref
| _ -> false)
No description provided.