-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix(#18265): crash on extension method without type nor RHS #18743
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- [E019] Syntax Error: tests/neg/i18265.scala:5:13 -------------------------------------------------------------------- | ||
5 | def twice // error | ||
| ^ | ||
| Missing return type | ||
| | ||
| longer explanation available when compiling with `-explain` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
trait Foo | ||
|
||
val foo = new Foo: | ||
extension (s: String) | ||
def twice // error |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ object StructuralTypes/*<-example::StructuralTypes.*/: | |
|
||
val V/*<-example::StructuralTypes.V.*/: Object/*->java::lang::Object#*/ { | ||
def scalameta/*<-local4*/: String/*->scala::Predef.String#*/ | ||
} = /*<-local6*/new: | ||
def scalameta/*<-local5*/ = "4.0" | ||
} = new: | ||
/*<-local6*/def scalameta/*<-local5*/ = "4.0" | ||
Comment on lines
-19
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just run
Which is correct, the current one or the previous one...?:thinking: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
V/*->example::StructuralTypes.V.*/.scalameta/*->scala::reflect::Selectable#selectDynamic().*/ | ||
end StructuralTypes/*->example::StructuralTypes.*/ |
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.
With brace syntax, the last token consumed by a parser is
}
, but with indent syntax, the last token consumed by a parser is OUTDENT, which causes mismatching spans(actual offset isn
, butreposition
set offset less thann
).Template
returned from templateBodyOpt has the exact span, so we reuse it.