Refactor FlexibleType to use TypeBounds instead of case class#26245
Refactor FlexibleType to use TypeBounds instead of case class#26245HarrisL2 wants to merge 18 commits into
Conversation
|
I don't think this is going in the right direction. Superficially, this may allow some macro test suites to pass in the short term. But the logic will probably be broken anyway. And in the long term, this will just force macros to handle flexible type specially anyway, like the compiler. IMO we should stick with the correct design with real |
dbaa86b to
5625b53
Compare
|
I disagree with @sjrd. A FlexibleType should behave exactly like a type constructor Also, |
|
One technical difference that we need to be careful about is that |
|
If we represent flexible types internally in the compiler using applied types, a remaining open question is how we want to expose them on the outside, specifically (1) in TASTy and (2) in the Quotes reflection interface. (1) In TASTy, there is currently an explicit representation of a flexible type. Currently, this PR keeps that representation, i.e., it detects an internal applied type that represents a flexible type and expresses it as an explicit (2) The Quotes reflection interface is sructured as a set of pattern match extractors. Currently in this PR, a flexible type represented by an applied type is matched by both the applied type extractor and by the specific flexible type extractor. |
Note that there's also |
|
Here are the results of the Open Community Build on this branch: |
I think it would be better to leave the applied type representation. That means FLEXIBLEtype would need to be kept around only for backwards compatibility. That would make the format simpler (we could relegate discussion of FLEXIBLEtype to a separate section on legacy tags).
I think that's fine.
It would be good to do a more high level analysis of that. What are the root failures in either system? |
The content of this PR suggests that this is not the case. There is exactly 0 spot where handling Quite the opposite in fact. In several places, the It would be much more believable if this PR were removing more code than it's adding. |
Refactors FlexibleTypes to have TypeBounds as underlying representation, which can help with macro-related code avoid match errors.
The key change is in Definitions.scala
How much have you relied on LLM-based tools in this contribution?
Minimally, for some refactoring
How was the solution tested?
Covered by existing tests (this is a refactoring)