-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Assorted bugfixes for new analysis #14658
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
…nction and Itself
…riant rather than on the type variable
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.
Yeah, these are all very much uncontroversial and we agreed on more or less all of them before, so I didn't even expect them to be pulled out again - fine to merge these back in :-).
if (sort.classes.size() != 1 || *sort.classes.begin() != m_analysis.typeSystem().primitiveClass(PrimitiveClass::Type)) | ||
sortString = ":" + TypeSystemHelpers{m_analysis.typeSystem()}.sortToString(m_analysis.typeSystem().env().sort(type)); | ||
std::optional<Type> const& inferredType = m_analysis.annotation<TypeInference>(_node).type; | ||
if (inferredType.has_value()) |
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.
As for random style remarks: I find .has_value()
on optional
s horrible myself personally :-D... but it doesn't matter at all, ultimately everybody can read both, so I don't bother pushing my own preferred style through.
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.
For me it's if (inferredType)
that's horrible. It does not read like a condition at all. It forces me stop and think in which way this can be interpreted as a boolean, while on seeing inferredType.has_value()
I immediately know it's an optional
and can move on smoothly. I'm really not sure why people don't find this jarring.
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.
That's my point, though - it's purely subjective and we spend way too much time and effort in general in flipping back and forth around purely subjective taste that has no actual bearing on overall readability.
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.
As in: I find this significantly less readable with .has_value()
than without - and I don't buy that it'd be worse for you to read it without that than it is for me to read it with that - we should just generally have a bit more flexibility around stuff like this (that would already significantly reduce number of comments on PRs).
Well, I thought you wanted all of the fixups removed from the base branch :) |
Assorted bugfixes for new analysis
Assorted bugfixes for new analysis
Assorted bugfixes for new analysis
Moved here from my fixups into
newAnalysis
:Function
types being created, instead ofFunction
andItself
.resolveRecursive()
not resolving type variables.index()
being used on theType
variant rather thanTypeVariable
index
toid
? The current name seems very prone to this kind of error.DebugWarner
.unify()
- should have been an assert.uint64_t
instead ofsize_t
used for the index inTypeEnvironment::fresh()
.size_t
everywhere else. This is part of compiler output though, so a portable type likeuint64_t
is probably a better choice though. Should we switch?