From f0cde59118cb35a702c58b0c6ddddbc6552ecb1f Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Mon, 16 Apr 2007 11:48:04 +0000 Subject: "fixed" bug 1040, re-opened as 1046 tcpoly_parseridioms no longer uses exotic method names -- exoticnames.scala is a dedicated test that I feel should pass (it doesn't) --- test/files/run/tcpoly_parseridioms.scala | 10 +++++----- test/pending/run/exoticnames.check | 0 test/pending/run/exoticnames.scala | 7 +++++++ 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 test/pending/run/exoticnames.check create mode 100644 test/pending/run/exoticnames.scala diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala index e163ea2ce8..0e2512f5bc 100644 --- a/test/files/run/tcpoly_parseridioms.scala +++ b/test/files/run/tcpoly_parseridioms.scala @@ -66,18 +66,18 @@ trait Idioms { } // TODO: `.` --> java.lang.ClassFormatError: Illegal method name "." in class Idioms$IdiomaticTarget class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) { - def `(` (a: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(i.pure(fun))(a)) + def <| (a: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(i.pure(fun))(a)) } class IdiomaticApp[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) { // where x <: s=>t -- TODO can this be expressed without generalised constraints? - def `,` [s, t](b: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(a.asInstanceOf[idi[s=>t]])(b)) + def <> [s, t](b: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(a.asInstanceOf[idi[s=>t]])(b)) - def `)` : idi[x] = a + def |> : idi[x] = a } class IdiomaticApp2[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) extends IdiomaticApp[idi, idiom, x](i, a) { - def `(` [s, t](b: idi[s]) = `,`[s,t](b) + def <| [s, t](b: idi[s]) = <>[s,t](b) } } @@ -98,7 +98,7 @@ trait ParserIdioms extends Parsers with Idioms { def num = or(accept('0', 0), or(accept('1', 1),accept('2', 2))) // TODO: how can parserIdiom(curry2(_)) be omitted? - def expr: Parser[Expr] = parserIdiomFun(curry2(Plus)) `(` num `,` num `)` + def expr: Parser[Expr] = parserIdiomFun(curry2(Plus)) <| num <> num |> implicit def curry2[s,t,u](fun: (s, t)=>u)(a: s)(b: t) = fun(a, b) implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c) diff --git a/test/pending/run/exoticnames.check b/test/pending/run/exoticnames.check new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/pending/run/exoticnames.scala b/test/pending/run/exoticnames.scala new file mode 100644 index 0000000000..7c8dcea5e8 --- /dev/null +++ b/test/pending/run/exoticnames.scala @@ -0,0 +1,7 @@ +// this is a run-test because the compiler should emit bytecode that'll pass the JVM's verifier +object Test extends Application { + def `(` = error("bla") + def `.` = error("bla") + def `)` = error("bla") + def `,` = error("bla") +} \ No newline at end of file -- cgit v1.2.3