Error Scala Is Not An Enclosing Class
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have is not an enclosing class android studio Meta Discuss the workings and policies of this site About Us is not an enclosing class intent Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with is not an enclosing class android asynctask us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just java inner class is not an enclosing class like you, helping each other. Join them; it only takes a minute: Sign up “scala is not an enclosing class” up vote 4 down vote favorite 1 When compiling this specification: import org.specs.Specification import org.specs.matcher.extension.ParserMatchers class ParserSpec extends Specification with ParserMatchers { type Elem = Char "Vaadin DSL parser" should { "parse attributes in parentheses" in {
Fragment Is Not An Enclosing Class
DslParser.attributes must( succeedOn(stringReader("""(attr1="val1")""")). withResult(Map[String, AttrVal]("attr1" -> AttrVal("val1", "String")))) } } } I get the following error: ParserSpec.scala:21 error: scala is not an enclosing class withResult(Map[String, AttrVal]("attr1" -> AttrVal("val1", "String")))) ^ I don't understand the error message here at all. Why could it appear? Scala version is 2.8.1, specs version is 1.6.7.2. DslParser.attributes has type Parser[Map[String, AttrVal]] and the combinators succeedOn and withResult are defined as follows: trait ParserMatchers extends Parsers with Matchers { case class SucceedOn[T](str: Input, resultMatcherOpt: Option[Matcher[T]]) extends Matcher[Parser[T]] { def apply(parserBN: => Parser[T]) = { val parser = parserBN val parseResult = parser(str) parseResult match { case Success(result, remainingInput) => val succParseMsg = "Parser "+parser+" succeeded on input "+str+" with result "+result val okMsgBuffer = new StringBuilder(succParseMsg) val koMsgBuffer = new StringBuilder(succParseMsg) val cond = resultMatcherOpt match { case None => true case Some(resultMatcher) => resultMatcher(result) match { case (success, okMessage, koMessage) => okMsgBuffer.append(" and ").append(okMessage) koMsgBuffer.append(" but ").append(koMessage) success } } (cond, okMsgBuffer.toString, koMsgBuffer.toString) case _ => (false, "Parser succeeded", "Parser "+parser+": "+parse
Type: Bug Status: CLOSED Priority: Major Resolution: Fixed Affects Version/s: Scala 2.8.1 Fix Version/s: Scala 2.9.2 Component/s: Misc Compiler Labels: None Description Not sure whether this is truly a bug, but when I search for
Scala Private Is Not An Enclosing Class
"scala is not an enclosing class", the top hit claims that this is not an enclosing class scala represents a (family of) bugs in the Scala type checking system: http://stackoverflow.com/questions/5143849/scala-is-not-an-enclosing-class At any rate, here's the code that expected class or package produces the message: object Test { import net.liftweb.json.JObject import net.liftweb.json.JsonDSL._ val map: Map[Int, String] = Map(1 -> "one") val json: JObject = ("myMap" -> map) } The error message would be http://stackoverflow.com/questions/5143849/scala-is-not-an-enclosing-class clearer if it gave some clue that the problem is that you can convert from a Map[String, ?] to a JObject, but not a Map[Int, ?]. Activity All Comments History Activity Ascending order - Click to sort in descending order Hide Permalink Johannes Rudolph added a comment - 27/Apr/12 2:55 PM Have you tried with Scala 2.9.x? It seems like a duplicate https://issues.scala-lang.org/browse/SI-5536 of SI-3152, which eventually was fixed. Show Johannes Rudolph added a comment - 27/Apr/12 2:55 PM Have you tried with Scala 2.9.x? It seems like a duplicate of SI-3152 , which eventually was fixed. Hide Permalink Adriaan Moors added a comment - 25/Jun/12 2:17 PM this one's probably both cannot reproduce and fixed i'm pretty sure about the former (i don't have lift lying around) and Johannes hinted at the latter Show Adriaan Moors added a comment - 25/Jun/12 2:17 PM this one's probably both cannot reproduce and fixed i'm pretty sure about the former (i don't have lift lying around) and Johannes hinted at the latter Hide Permalink Nebu Pookins added a comment - 25/Jun/12 4:50 PM Sorry, I forgot about this issue until I got the notification from Adriaan Moors. I just tested on 2.9.2, and I indeed get a more precise compile error now. Show Nebu Pookins added a comment - 25/Jun/12 4:50 PM Sorry, I forgot about this issue until I got the notification from Adriaan Moors. I just tested on 2.9.2, and I indeed get a more precise compile
In ExportXMLWordPrintable Details Type: Bug Status: CLOSED Priority: Major Resolution: Fixed Affects Version/s: None Fix Version/s: Scala 2.9.0 Component/s: Misc Compiler Labels: access community name-mangling Description class A { protected def x = 0 protected[A] def y = 0 } class B extends A { override def x = 1 println(super[A].y) override def https://issues.scala-lang.org/browse/SI-1994 y = 1 } gives the following compile error: P.scala:9: error: method y overrides nothing override def y = 1 ^ one error found This is either a misleading error message, since A.y is definitely visible in B or as I think a plain error. Section 5.1.4 of the spec doesn't disallow this. The same applies for qualified private members as in: class A { class B { private[A] def x = 0 } class C extends B is not { override def x = 1 } } Issue Links is blocked by SI-6794 Can we please reach some kind of decision on access Open is mentioned by SI-2806 Name mangling has outstripped the abilities of lonesome '$' Open relates to SI-6794 Can we please reach some kind of decision on access Open Activity All Comments History Activity Ascending order - Click to sort in descending order Hide Permalink Paul Phillips added a comment - 18/May/09 4:27 PM is not an This is mostly a duplicate of SI-1352. The issue is not that you can't override them, but that you can't widen the visibility to public. This works: class A { class B { private[A] def x = 0 } class C extends B { override private[A] def x = 1 // or even this works // override protected[A] def x = 1 } } My "mostly" qualifier above is because it doesn't look like you can override def y in your first example, because A is not an enclosing class inside B: // override protected[A] def y = 1 a.scala:9: error: A is not an enclosing class override protected[A] def y = 1 ^ // override protected def y = 1 a.scala:9: error: method y overrides nothing override protected def y = 1 ^ // override protected[B] def y = 1 a.scala:9: error: method B$$$$y overrides nothing override protected[B] def y = 1 ^ Show Paul Phillips added a comment - 18/May/09 4:27 PM This is mostly a duplicate of SI-1352 . The issue is not that you can't override them, but that you can't widen the visibility to public. This works: class A { class B { private[A] def x = 0 } class C extends B { override private[A] def x = 1 // or even this works // override protected[A] def x = 1 } } My "mostly"