Skip to content

Update wording of uninitialized value error to be grammatically correct #14292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ object Semantic {

/** Utility definition used for better error-reporting of argument errors */
case class ArgInfo(value: Value, source: Tree) {
def promote: Contextual[List[Error]] = value.promote("May only use initialized value as arguments", source)
def promote: Contextual[List[Error]] = value.promote("Only initialized values may be used as arguments", source)
}

/** Evaluate an expression with the given value for `this` in a given class `klass`
Expand Down
6 changes: 3 additions & 3 deletions tests/init/neg/closureLeak.check
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Error: tests/init/neg/closureLeak.scala:11:14 -----------------------------------------------------------------------
11 | l.foreach(a => a.addX(this)) // error
| ^^^^^^^^^^^^^^^^^
| Cannot prove that the value is fully-initialized. May only use initialized value as arguments.
| Cannot prove that the value is fully-initialized. Only initialized values may be used as arguments.
|
| The unsafe promotion may cause the following problem:
| Cannot prove that the value is fully initialized. May only use initialized value as arguments.
| The unsafe promotion may cause the following problem:
| Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.
4 changes: 2 additions & 2 deletions tests/init/neg/default-this.check
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Error: tests/init/neg/default-this.scala:9:8 ------------------------------------------------------------------------
9 | compare() // error
| ^^^^^^^
| Cannot prove that the value is fully initialized. May only use initialized value as arguments. Calling trace:
| -> val result = updateThenCompare(5) [ default-this.scala:11 ]
|Cannot prove that the value is fully initialized. Only initialized values may be used as arguments. Calling trace:
| -> val result = updateThenCompare(5) [ default-this.scala:11 ]
4 changes: 2 additions & 2 deletions tests/init/neg/promotion-loop.check
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Error: tests/init/neg/promotion-loop.scala:16:10 --------------------------------------------------------------------
16 | println(b) // error
| ^
| Cannot prove that the value is fully-initialized. May only use initialized value as arguments.
| Cannot prove that the value is fully-initialized. Only initialized values may be used as arguments.
|
| The unsafe promotion may cause the following problem:
| Cannot prove that the value is fully initialized. May only use initialized value as arguments.
| Cannot prove that the value is fully initialized. Only initialized values may be used as arguments.
4 changes: 2 additions & 2 deletions tests/init/neg/t3273.check
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
-- Error: tests/init/neg/t3273.scala:4:42 ------------------------------------------------------------------------------
4 | val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // error
| ^^^^^^^^^^^^^^^
| Cannot prove that the value is fully-initialized. May only use initialized value as arguments.
| Cannot prove that the value is fully-initialized. Only initialized values may be used as arguments.
|
| The unsafe promotion may cause the following problem:
| Access non-initialized value num1. Calling trace:
| -> val num1: LazyList[Int] = 1 #:: num1.map(_ + 1) // error [ t3273.scala:4 ]
-- Error: tests/init/neg/t3273.scala:5:61 ------------------------------------------------------------------------------
5 | val num2: LazyList[Int] = 1 #:: num2.iterator.map(_ + 1).to(LazyList) // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Cannot prove that the value is fully-initialized. May only use initialized value as arguments.
| Cannot prove that the value is fully-initialized. Only initialized values may be used as arguments.
|
| The unsafe promotion may cause the following problem:
| Access non-initialized value num2. Calling trace:
Expand Down