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

[Language] Abstract or static method named the same as enclosing class #3284

Closed
DartBot opened this issue May 29, 2012 · 5 comments
Closed
Assignees
Labels
area-language New language issues should be filed at https://github.com/dart-lang/language type-enhancement A request for a change that isn't a bug
Milestone

Comments

@DartBot
Copy link

DartBot commented May 29, 2012

This issue was originally filed by rodion...@unipro.ru


Can't find a mention of this being prohibited anywhere in the spec (0.09) although it probably should be.

VM takes issue with this code (even if the constructor/method is not invoked in main):
class C {
  int C() {}
}

but not with this:

class C {
  abstract C();
}

main() {
    new C();
}

of course, there's a NoSuchMethodException if I try to call 'new C().C()', but no compile-time error.

The result of executing this:

class C {
  static C() {return 1;}
}

main() {
    new C();
}

is also confounding:
Error: line 23 pos 10: invalid arguments passed to constructor 'C' for class 'C'

@kasperl
Copy link

kasperl commented May 29, 2012

Added Area-Language, Triaged labels.

@gbracha
Copy link
Contributor

gbracha commented May 29, 2012

I expect to see shadowing warnings on these and no more.


Set owner to @gbracha.
Added Accepted label.

@gbracha
Copy link
Contributor

gbracha commented May 29, 2012

As this stands, the shadowing is warning. Our tendency is to make this an error, interpreting these cases as malformed constructors rather than shadowing methods. Details TBD.


Added this to the M1 milestone.
Removed Type-Defect label.
Added Type-Enhancement label.

@gbracha
Copy link
Contributor

gbracha commented Jul 4, 2012

Added to section 7:

It is compile time error if a class C declares a member with the same name as C.


Added Done label.

@gbracha
Copy link
Contributor

gbracha commented Jul 4, 2012

Analyzer issue: 3986
VM issu : 3987
dart2js issue: 3988

@DartBot DartBot added Type-Enhancement area-language New language issues should be filed at https://github.com/dart-lang/language labels Jul 4, 2012
@DartBot DartBot added this to the M1 milestone Jul 4, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue Jan 4, 2023
…_launcher, clock, crypto, csslib, dartdoc, html, http, http_multi_server, intl, package_config, pool, protobuf, pub_semver, source_map_stack_trace, source_maps, source_span, sse, stack_trace, stream_channel, term_glyph, test, test_descriptor, test_process, test_reflective_loader, watcher, web_socket_channel, yaml

Revisions updated by `dart tools/rev_sdk_deps.dart`.

bazel_worker (https://github.com/dart-lang/bazel_worker/compare/9f21e1d..b35c25e):
  b35c25e  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#66)

benchmark_harness (https://github.com/dart-lang/benchmark_harness/compare/ee7a253..76881df):
  76881df  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#80)

boolean_selector (https://github.com/dart-lang/boolean_selector/compare/5082b3d..ba7d86b):
  ba7d86b  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#41)

browser_launcher (https://github.com/dart-lang/browser_launcher/compare/2712dda..f2f01e4):
  f2f01e4  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#37)

clock (https://github.com/dart-lang/clock/compare/8a8231f..6b8b7bf):
  6b8b7bf  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#41)

crypto (https://github.com/dart-lang/crypto/compare/bf0c33b..f854f2f):
  f854f2f  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#138)

csslib (https://github.com/dart-lang/csslib/compare/34203c0..d776535):
  d776535  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#156)

dartdoc (https://github.com/dart-lang/dartdoc/compare/ce25524..9ed196f):
  9ed196f1  2023-01-03  Sam Rawlins  Move many test files to test_reflective_loader (#3284)

html (https://github.com/dart-lang/html/compare/28fb8b9..3dd00b0):
  3dd00b0  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#193)

http (https://github.com/dart-lang/http/compare/38d5dd9..d434d42):
  d434d42  2023-01-03  Brian Quinlan  Make it possible to use a custom CronetEngine with runWithClient (#843)

http_multi_server (https://github.com/dart-lang/http_multi_server/compare/e31c698..beb40a7):
  beb40a7  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#47)

intl (https://github.com/dart-lang/intl/compare/59e7bff..c61fdd1):
  c61fdd1  2023-01-04  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#528)
  2a5e3a2  2023-01-04  Copybara-Service  Merge pull request #527 from mateendev3:patch-2
  07a5847  2022-12-31  Mateen Mehmood  Update date_format.dart

package_config (https://github.com/dart-lang/package_config/compare/abb4aec..2e1a8ec):
  2e1a8ec  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#128)

pool (https://github.com/dart-lang/pool/compare/1ea5b03..713e631):
  713e631  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#59)

protobuf (https://github.com/dart-lang/protobuf/compare/1d1c92a..dd04535):
  dd04535  2023-01-04  Mahdi K. Fard  Fix avoid_renaming_method_parameters linter warning. (#783)
  4b1fc34  2023-01-04  Mahdi K. Fard  Removes a non-existing lint rule. (#784)

pub_semver (https://github.com/dart-lang/pub_semver/compare/1723111..3946e33):
  3946e33  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#76)

source_map_stack_trace (https://github.com/dart-lang/source_map_stack_trace/compare/8d8078f..e5f9564):
  e5f9564  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#31)

source_maps (https://github.com/dart-lang/source_maps/compare/b031e2c..d995912):
  d995912  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#70)

source_span (https://github.com/dart-lang/source_span/compare/d1d47e5..72d5c55):
  72d5c55  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#89)

sse (https://github.com/dart-lang/sse/compare/2de27fe..3c37edb):
  3c37edb  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#73)

stack_trace (https://github.com/dart-lang/stack_trace/compare/cf3562e..c08ee90):
  c08ee90  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#125)

stream_channel (https://github.com/dart-lang/stream_channel/compare/9143047..0a7800a):
  0a7800a  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#83)

term_glyph (https://github.com/dart-lang/term_glyph/compare/822cd5b..2bf4594):
  2bf4594  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#30)

test (https://github.com/dart-lang/test/compare/8235a25..3415089):
  34150897  2023-01-03  dependabot[bot]  Bump ossf/scorecard-action from 2.0.6 to 2.1.2 (#1838)
  5f01dd97  2023-01-03  dependabot[bot]  Bump github/codeql-action from 1.0.26 to 2.1.37 (#1839)

test_descriptor (https://github.com/dart-lang/test_descriptor/compare/13dbc20..b73c691):
  b73c691  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#46)

test_process (https://github.com/dart-lang/test_process/compare/1774aa7..62ea2ba):
  62ea2ba  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#37)

test_reflective_loader (https://github.com/dart-lang/test_reflective_loader/compare/52b6753..cf58259):
  cf58259  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#43)

watcher (https://github.com/dart-lang/watcher/compare/3259107..2e0db71):
  2e0db71  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#132)

web_socket_channel (https://github.com/dart-lang/web_socket_channel/compare/a90e740..ebd0fe9):
  ebd0fe9  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#244)

yaml (https://github.com/dart-lang/yaml/compare/f699275..02be51e):
  02be51e  2023-01-03  dependabot[bot]  Bump actions/checkout from 3.1.0 to 3.2.0 (#133)

Change-Id: I56af76e89a75b0712b290ea154f606781183bec7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278368
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language New language issues should be filed at https://github.com/dart-lang/language type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants