Skip to content
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

Declaring a method named BUILD should produce a warning #1025

Closed
p6rt opened this issue May 28, 2009 · 6 comments
Closed

Declaring a method named BUILD should produce a warning #1025

p6rt opened this issue May 28, 2009 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 28, 2009

Migrated from rt.perl.org#66120 (status was 'resolved')

Searchable as RT66120$

@p6rt
Copy link
Author

p6rt commented May 28, 2009

From @pmichaud

See S12​:611​:

  "If you attempt to get around this by declaring C<BUILD> as
  a method rather than a submethod, that will also be flagged as a dire
  (but suppressible) compile-time warning."

Pm

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

From @jnthn

On Thu May 28 11​:52​:22 2009, pmichaud wrote​:

See S12​:611​:

"If you attempt to get around this by declaring C\<BUILD> as
a method rather than a submethod, that will also be flagged as a dire
\(but suppressible\) compile\-time warning\."

I implemented the warning in git 1317e53. Assigning to moritz++ for
spectesting, if it's possible to do so. Can we close this ticket after
that (we do what the subject of the ticket says now)? Seems the method
of suppression is not spec'd yet...

Jonathan

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 30, 2009

From @jnthn

Oops, forgot to cc this to the list...

On Tue Jun 30 05​:30​:14 2009, jnthn@​jnthn.net wrote​:

On Thu May 28 11​:52​:22 2009, pmichaud wrote​:

See S12​:611​:

"If you attempt to get around this by declaring C\<BUILD> as
a method rather than a submethod, that will also be flagged as a

dire

\(but suppressible\) compile\-time warning\."

I implemented the warning in git 1317e53. Assigning to moritz++ for
spectesting, if it's possible to do so. Can we close this ticket after
that (we do what the subject of the ticket says now)? Seems the method
of suppression is not spec'd yet...

Jonathan

@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S12-construction/BUILD.t

commit 019a2b38ac7a6ba8bb99d06e6b0843d3aa3eff0d
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Oct 20 21​:06​:48 2009 +0000

  [t/spec] test for RT #​66120, a method BUILD should warn
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;28862 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S12-construction/BUILD.t b/t/spec/S12-construction/BUILD.t
index 783f223..4f53852 100644
--- a/t/spec/S12-construction/BUILD.t
+++ b/t/spec/S12-construction/BUILD.t
@@ -1,7 +1,7 @@
 use v6;
 use Test;
 
-plan 7;
+plan 8;
 
 # L<S12/Construction and Initialization/The default BUILD and BUILDALL>
 
@@ -97,4 +97,13 @@ TestCompiler.new;
 is $counter, 1, "testing BUILD in compiler subclass";
 }
 
+{
+    BEGIN { @*INC.push: 't/spec/packages' }
+    use Test::Util;
+    is_run
+        'class Foo { method BUILD() { ... } }',
+        { out => '', err => /BUILD/ & /submethod/ },
+        'method BUILD produces a compile-time warning';
+}
+
 # vim: ft=perl6

@p6rt p6rt closed this as completed Oct 20, 2009
@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant