Repository navigation
Fix crash on invalid opaque type in package - #26118
Conversation
|
Fair point, let's report an error explicitly, in fact it now looks better since it also means the "cyclic reference involving TestCases" no longer shows and that one was weird |
250259c to
2a47946
Compare
Still seems to be in the checkfile? |
|
I said orally this could maybe be a syntax error, but no, |
|
And I guess this example should actually pass if we have a type that takes a parameter instead of |
I'm not sure what you mean |
Ah yes, there were actually 2 of them before... so it's still not amazing. |
2a47946 to
8a930ce
Compare
|
@mbovel you were right the parser is a much better place for this, see the new error message |
I mean this compiles: type F[S] = S
trait I:
type T: FAnd I'd expect the At first sight, I'd say (current results on type F[X] = X
trait I1:
type T: F // works ✅
opaque type S: F // crash, but should work
trait I2:
type T: Int // error "Illegal context bound" ✅
opaque type S: Int // crash, but should error
class C1:
type T: F // error "No given instance of type F[C.this.T]" ✅
opaque type S: F // crash, but should error
class C2:
type T: Int // error "Illegal context bound" ✅
opaque type S: Int // crash, but should error
class C3:
given F[T] = ???
type T: F // error "Conflicting definitions" 🤔
opaque type S: F // crash, but should work or error
object O1:
type T: F // error "Declaration of given instance given_F_T not allowed here" ✅
// error "Conflicting definitions" 🤔
opaque type S: F // crash, but should error
object O2:
type T: Int // error "Illegal context bound" ✅
opaque type S: Int // crash, but should error |
mbovel
left a comment
There was a problem hiding this comment.
I guess we can already merge to avoid the crash.
But longer-term, I think we should support opaque types with context bounds!
Fixes #26089
How much have you relied on LLM-based tools in this contribution?
Not at all
How was the solution tested?
New automated tests (including the issue's reproducer, if applicable)