@@ -1703,20 +1703,27 @@ object Parsers {
1703
1703
1704
1704
def refinedType () = refinedTypeRest(withType())
1705
1705
1706
+ /** Disambiguation: a `^` is treated as a postfix operator meaning `^{any}`
1707
+ * if followed by `{`, `->`, or `?->`,
1708
+ * or followed by a new line (significant or not),
1709
+ * or followed by a token that cannot start an infix type.
1710
+ * Otherwise it is treated as an infix operator.
1711
+ */
1712
+ private def isTrailingUpArrow =
1713
+ val ahead = in.lookahead
1714
+ ahead.token == LBRACE
1715
+ || ahead.isIdent(nme.PUREARROW )
1716
+ || ahead.isIdent(nme.PURECTXARROW )
1717
+ || ! canStartInfixTypeTokens.contains(ahead.token)
1718
+ || ahead.lineOffset > 0
1719
+
1706
1720
def refinedTypeRest (t : Tree ): Tree = {
1707
1721
argumentStart()
1708
1722
if in.isNestedStart then
1709
1723
refinedTypeRest(atSpan(startOffset(t)) {
1710
1724
RefinedTypeTree (rejectWildcardType(t), refinement(indentOK = true ))
1711
1725
})
1712
- else if in.isIdent(nme.UPARROW )
1713
- && (in.lookahead.token == LBRACE
1714
- || ! canStartInfixTypeTokens.contains(in.lookahead.token)
1715
- || in.lookahead.lineOffset > 0 )
1716
- // Disambiguation: a `^` is treated as a postfix operator meaning `^{any}`
1717
- // if followed by `{` or a new line (significant or not), or a token that
1718
- // cannot start an infix type. Otherwise it is treated as an infix operator.
1719
- then
1726
+ else if in.isIdent(nme.UPARROW ) && isTrailingUpArrow then
1720
1727
val upArrowStart = in.offset
1721
1728
in.nextToken()
1722
1729
def cs =
0 commit comments