diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-05-04 12:44:40 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-05-04 16:00:11 -0700 |
commit | 6379b70d952cf0eea96d205e14a291b441f9cd45 (patch) | |
tree | 5f26e590ef4a8dbd30519b8cf368b277a3c2bff8 /test/files | |
parent | f952a812340db7bc11f45b45f46e4b8ce7d6fb49 (diff) | |
download | scala-6379b70d952cf0eea96d205e14a291b441f9cd45.tar.gz scala-6379b70d952cf0eea96d205e14a291b441f9cd45.tar.bz2 scala-6379b70d952cf0eea96d205e14a291b441f9cd45.zip |
SI-9045 Error on recursive ctor
If the constructor invokes itself, say so.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/constrs.check | 2 | ||||
-rw-r--r-- | test/files/neg/t4460a.check | 2 | ||||
-rw-r--r-- | test/files/neg/t4460b.check | 2 | ||||
-rw-r--r-- | test/files/neg/t9045.check | 7 | ||||
-rw-r--r-- | test/files/neg/t9045.scala | 8 |
5 files changed, 18 insertions, 3 deletions
diff --git a/test/files/neg/constrs.check b/test/files/neg/constrs.check index 4f4a12bc13..8a5bd97ae3 100644 --- a/test/files/neg/constrs.check +++ b/test/files/neg/constrs.check @@ -7,7 +7,7 @@ constrs.scala:6: error: value u is not a member of object test constrs.scala:10: error: called constructor's definition must precede calling constructor's definition def this() = this("abc") ^ -constrs.scala:12: error: called constructor's definition must precede calling constructor's definition +constrs.scala:12: error: constructor invokes itself def this(x: Boolean) = this(x) ^ constrs.scala:16: error: type mismatch; diff --git a/test/files/neg/t4460a.check b/test/files/neg/t4460a.check index b711e7acb1..7a7618a114 100644 --- a/test/files/neg/t4460a.check +++ b/test/files/neg/t4460a.check @@ -1,4 +1,4 @@ -t4460a.scala:6: error: called constructor's definition must precede calling constructor's definition +t4460a.scala:6: error: constructor invokes itself def this() = this() // was binding to Predef.<init> !! ^ one error found diff --git a/test/files/neg/t4460b.check b/test/files/neg/t4460b.check index f0e703fd10..9a621dbd5c 100644 --- a/test/files/neg/t4460b.check +++ b/test/files/neg/t4460b.check @@ -1,4 +1,4 @@ -t4460b.scala:7: error: called constructor's definition must precede calling constructor's definition +t4460b.scala:7: error: constructor invokes itself def this() = this() // was binding to Predef.<init> !! ^ one error found diff --git a/test/files/neg/t9045.check b/test/files/neg/t9045.check new file mode 100644 index 0000000000..07d0e2dd74 --- /dev/null +++ b/test/files/neg/t9045.check @@ -0,0 +1,7 @@ +t9045.scala:3: error: constructor invokes itself + def this(axes: Array[Int]) = this(axes) + ^ +t9045.scala:6: error: called constructor's definition must precede calling constructor's definition + def this(d: Double) = this(d.toLong) + ^ +two errors found diff --git a/test/files/neg/t9045.scala b/test/files/neg/t9045.scala new file mode 100644 index 0000000000..e6710ab324 --- /dev/null +++ b/test/files/neg/t9045.scala @@ -0,0 +1,8 @@ + +case class AffineImageShape(axes: Seq[Int]) { + def this(axes: Array[Int]) = this(axes) +} +class X(i: Int) { + def this(d: Double) = this(d.toLong) + def this(n: Long) = this(n.toInt) +} |