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

Type checking of named arguments is wrong. #932

Closed
peter-ahe-google opened this issue Dec 21, 2011 · 6 comments
Closed

Type checking of named arguments is wrong. #932

peter-ahe-google opened this issue Dec 21, 2011 · 6 comments
Assignees

Comments

@peter-ahe-google
Copy link
Contributor

$ dartc fisk.dart
fisk.dart:4: int is not assignable to String
     3: main() {
     4: fisk(i: 1);
$ cat fisk.dart
fisk([String string, int i]) {}

main() {
  fisk(i: 1);
}

@peter-ahe-google
Copy link
Contributor Author

The implementation for type checking named arguments is bogus. This patch removes the symptom, but doesn't correctly implement type checking of named arguments.

--- a/dart/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/dart/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -532,12 +532,8 @­@ public class TypeAnalyzer implements DartCompilationPhase {
       Map<String, Type> namedParameterTypes = ftype.getNamedParameterTypes();
       Iterator<Type> named = namedParameterTypes.values().iterator();
       while (named.hasNext() && argumentTypes.hasNext()) {

  •    checkAssignable(argumentNodes.get(argumentCount), named.next(), argumentTypes.next());
    
  •    argumentCount++;
    
  •  }
    
  •  while (ftype.hasRest() && argumentTypes.hasNext()) {
    
  •    checkAssignable(argumentNodes.get(argumentCount), ftype.getRest(), argumentTypes.next());
    
  •    argumentCount++;
    
  •    // Cannot deal with named arguments.
    
  •    return ftype.getReturnType();
    
           }
           while (argumentTypes.hasNext()) {
             argumentTypes.next();

@DartBot
Copy link

DartBot commented Jan 4, 2012

This comment was originally written by [email protected]


Frog handles this just fine - this is a dartc issue.


Removed Area-Frog label.
Added Area-Compiler label.

@scheglov
Copy link
Contributor

Set owner to @scheglov.

@scheglov
Copy link
Contributor

@scheglov
Copy link
Contributor

Added Started label.

@scheglov
Copy link
Contributor

Added Fixed label.

dart-bot pushed a commit that referenced this issue Nov 6, 2020
2020-11-05 [email protected] Fixes #602: New tests for least and greatest closures added.
2020-11-05 [email protected] #926. Rewrite io/Process/start_A01_t02 test to work on precompiled environment
2020-11-05 [email protected] #932. Rewrite HttpRequestUpload/onLoad_A01_t01 test to send correct HttpRequest
2020-11-04 [email protected] Fixes #956. Don't expect extension invocation on type dynamic
2020-11-04 [email protected] Convert some multi-tests to static error framework  (#958)
2020-11-03 [email protected] Fixes #602: dynamic tests for least and greatest closures updated.
2020-11-03 [email protected] Fixes #602: tests for least and greatest closures added.
2020-10-28 [email protected] #926. Fix two Process tests to use 'process_test' tool
2020-10-28 [email protected] #926. Rewrite two Process tests to use 'process_test' tool
2020-10-28 [email protected] Fixes #955. Expect less specific error for typed_data tests
2020-10-26 [email protected] Fixes #954. Change the line where we expect an error for CFE
2020-10-20 [email protected] Fixes #912. Abstract variables syntax tests added
2020-10-19 [email protected] #912. More external variables syntax tests added
2020-10-17 [email protected] External variables syntax test added
2020-10-16 [email protected] #912. More test for static analysis of external variables added
2020-10-15 [email protected] #912. Test for static analysis of external variables added
2020-10-14 [email protected] #912. Test for static analysis if abstract variables added

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,analyzer-nnbd-win-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: Id9cde784918faa4e891da8c4cb448d415a7a18aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170680
Reviewed-by: William Hesse <[email protected]>
Commit-Queue: Alexander Thomas <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 19, 2020
2020-11-19 [email protected] #926.Add Platform.executableArguments to Process.run() command to not to fail on --enable-assert configuration
2020-11-19 [email protected] #926.Add Platform.executableArguments to Process.run() command to not to fail on --enable-assert configuration
2020-11-18 [email protected] Fixes #966. Move certificates to RawSecureServerSocket directory
2020-11-18 [email protected] #926. Fixed test that fail on precompiled environment in a strong mode
2020-11-17 [email protected] Fixes #951. Remove excessive @static-warning
2020-11-17 [email protected] Fixes #946: LanguageFeatures/Instantiate-to-bound/nonfunction_typedef tests updated according to the SDK changes, missing tests added.
2020-11-17 [email protected] #932. Some HttpRequest tests fixed to work well with cross origin requests
2020-11-16 [email protected] Process kill test fixed to work on different platforms
2020-11-16 [email protected] External variable test that expects compile time error on dart2js added
2020-11-13 [email protected] Fixes #926. Remove "--enable-experiment=non-nullable" option from script that runs another process
2020-11-12 [email protected] #926. File lock checking tests rewritten to not to fail on precompiled environment. Second part
2020-11-12 [email protected] Fixes #602: Missing issue tags added.
2020-11-11 [email protected] #926. File lock checking tests rewritten to not to fail on precompiled environment
2020-11-11 [email protected] Issue numbers added
2020-11-11 [email protected] Fixes #963: test expected result corrected, test template for all generic typedefs updated.
2020-11-10 [email protected] #926. ProcessSignal tests rewritten to not to fail on precompiled environment
2020-11-10 [email protected] #926. Process tests rewritten to not to fail on precompiled environment
2020-11-10 [email protected] #961. Process tests rewritten to not to use process_test tool
2020-11-10 [email protected] Fixes #602: Missing Issue tag added.
2020-11-10 [email protected] Fixes #960. Null safety execution modes renamed and mentions of obsolete checked mode removed
2020-11-10 [email protected] Remove wrong error expectations
2020-11-09 [email protected] Fixes #962. Change CFE error messages expectations
2020-11-08 [email protected] Fixes #602: New tests for least and greatest closures added.

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-win-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: I7aff067ec96f762490de15daa20c40dff2b0ae96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172940
Reviewed-by: William Hesse <[email protected]>
dart-bot pushed a commit that referenced this issue Nov 25, 2020
2020-11-25 [email protected] Fixes #968: missing testing options added back.
2020-11-25 [email protected] #969. Line numbers where we expect an error fixed
2020-11-25 [email protected] #969. Stdout tests failures on Windows fixed. Don't pass executable arguments to the Process
2020-11-24 [email protected] Fixes #968: non-nullable shared option removed.
2020-11-23 [email protected] #932. HttpRequest tests fixed to work with cross origin
2020-11-20 [email protected] #926.Tryjob failures fixed

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: I32eaa75a0fcf4b5b7d8c4855b311a46948afb6f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173964
Reviewed-by: William Hesse <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants