Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
disallow 'default late' because it has unclear semantics #6455
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Sep 2, 2017
1 parent ab68a1b commit 551f09f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion typechecker/en/modules/declarations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,8 @@ case (hexadecimal) {
<para>A reference annotated <literal>late</literal> may not be initialized or
assigned a value by the class initializer. A parameter may not be annotated
<literal>late</literal>. A reference not belonging to a class may not be annotated
<literal>late</literal>.</para>
<literal>late</literal>. A reference annotated <literal>formal</literal> or
<literal>default</literal> may not be annotated <literal>late</literal>.</para>

<para>If a class declares or inherits a <literal>variable</literal> reference, it
must (directly or indirectly) extend the class <literal>Basic</literal> defined in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,9 @@ public void visit(Tree.AttributeDeclaration that) {
if (v.isFormal()) {
that.addError("formal attribute may not be annotated 'late'");
}
else if (v.isDefault()) {
that.addError("default attribute may not be annotated 'late'");
}
else if (!v.isClassOrInterfaceMember() &&
!v.isToplevel()) {
that.addError("block-local value may not be annotated 'late'");
Expand Down

0 comments on commit 551f09f

Please sign in to comment.