Skip to content

Commit 5f5b9a6

Browse files
committed
Add span when translating with to an and type
1 parent 38ba6e1 commit 5f5b9a6

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ object Parsers {
15491549
else
15501550
if sourceVersion.isAtLeast(`3.1`) then
15511551
deprecationWarning(DeprecatedWithOperator(), withOffset)
1552-
makeAndType(t, withType())
1552+
atSpan(startOffset(t)) { makeAndType(t, withType()) }
15531553
else t
15541554

15551555
/** AnnotType ::= SimpleType {Annotation}

tests/neg-scalajs/js-native-members.check

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@
8686
57 | val bar = js.native // error
8787
| ^^^^^^^^^^^^^^^^^^^
8888
| The type of bar must be explicitly specified because it is JS native.
89-
-- Error: tests/neg-scalajs/js-native-members.scala:65:8 ---------------------------------------------------------------
90-
65 | def apply: Int = js.native // error
89+
-- Error: tests/neg-scalajs/js-native-members.scala:66:8 ---------------------------------------------------------------
90+
66 | def apply: Int = js.native // error
9191
| ^
9292
|A member named apply represents function application in JavaScript. A parameterless member should be exported as a property. You must add @JSName("apply")
93-
-- Error: tests/neg-scalajs/js-native-members.scala:76:8 ---------------------------------------------------------------
94-
76 | val apply: Int = js.native // error
93+
-- Error: tests/neg-scalajs/js-native-members.scala:77:8 ---------------------------------------------------------------
94+
77 | val apply: Int = js.native // error
9595
| ^
9696
|A member named apply represents function application in JavaScript. A parameterless member should be exported as a property. You must add @JSName("apply")
97-
-- Error: tests/neg-scalajs/js-native-members.scala:87:8 ---------------------------------------------------------------
98-
87 | var apply: Int = js.native // error
97+
-- Error: tests/neg-scalajs/js-native-members.scala:88:8 ---------------------------------------------------------------
98+
88 | var apply: Int = js.native // error
9999
| ^
100100
|A member named apply represents function application in JavaScript. A parameterless member should be exported as a property. You must add @JSName("apply")

tests/neg-scalajs/js-native-members.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ object A3 {
5555
class A4 extends js.Object {
5656
def foo = js.native // error
5757
val bar = js.native // error
58+
def assign[T, U](target: T, source: U): T with U = js.native // ok
5859
}
5960

6061
// Members named `apply`

0 commit comments

Comments
 (0)