summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala21
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala3
2 files changed, 14 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index c7e59925d5..aa75b710de 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -556,14 +556,14 @@ trait Parsers requires SyntaxAnalyzer {
}
/** Type1 ::= SimpleType {with SimpleType} [Refinement]
- * TypePattern1 ::= SimpleTypePattern [TypePatternArgs]
+ * TypePattern1 ::= SimpleTypePattern {with SimpleTypePattern}
*/
def type1(isPattern: boolean): Tree =
type1rest(in.currentPos, simpleType(isPattern), isPattern)
def type1rest(pos: int, t: Tree, isPattern: boolean): Tree = {
var ts = new ListBuffer[Tree] + t
- while (in.token == WITH && !isPattern) {
+ while (in.token == WITH) {
in.nextToken(); ts += simpleType(isPattern)
}
atPos(pos) {
@@ -572,14 +572,15 @@ trait Parsers requires SyntaxAnalyzer {
}
}
- /** SimpleType ::= SimpleType TypeArgs
- * | SimpleType `#' Id
- * | StableId
- * | Path `.' type
- * | `(' Type `)'
- * SimpleTypePattern ::= SimpleTypePattern "#" Id
- * | StableId
- * | Path `.' type)
+ /** SimpleType ::= SimpleType TypeArgs
+ * | SimpleType `#' Id
+ * | StableId
+ * | Path `.' type
+ * | `(' Type `)'
+ * SimpleTypePattern ::= SimpleTypePattern TypePatternArgs
+ * | SimpleTypePattern1 "#" Id
+ * | StableId
+ * | Path `.' type
*/
def simpleType(isPattern: boolean): Tree = {
val pos = in.currentPos
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 9f1d17fc8c..0d2d65567d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -810,6 +810,9 @@ trait Infer requires Analyzer {
}
}
checkCheckable(pos, pre)
+ case RefinedType(parents, decls) =>
+ if (decls.isEmpty) for (val p <- parents) checkCheckable(pos, p)
+ else patternWarning(tp, "refinement ")
case ThisType(_) =>
;
case NoPrefix =>