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

Improve error message for out-of-order library tags #6082

Closed
DartBot opened this issue Oct 19, 2012 · 14 comments
Closed

Improve error message for out-of-order library tags #6082

DartBot opened this issue Oct 19, 2012 · 14 comments
Assignees
Labels
type-enhancement A request for a change that isn't a bug web-dart2js

Comments

@DartBot
Copy link

DartBot commented Oct 19, 2012

This issue was originally filed by domi...@google.com


just after import 'package:box2d/box2d.dart';

>> The last is failing in dart analyzer:
>> [echo] Analyzing dartbox2d/example/demos/BallCage.dart
>> [exec] file:dartbox2d/lib/box2d_browser.dart:22: Unexpected token
>> 'STRING' (expected '(')
>> [exec] 21:
>> [exec] 22: export 'package:box2d/box2d.dart';
>> [exec] ~~~~~~~~~~~~~~~~~~~~~~~~~~
>> [exec] file:dartbox2d/lib/box2d_browser.dart:22: The token ';' cannot
>> be used as an identifier
>> [exec] 21:
>> [exec] 22: export 'package:box2d/box2d.dart';
>> [exec] ~
>> [exec] Compilation failed with 2 problems.
>>
>> and dart2js:
>> [echo] Generating JS "dartbox2d/example/demos/BallCage.dart.js" from
>> "dartbox2d/example/demos/BallCage.dart"
>> [exec] example/demos/packages/box2d/box2d_browser.dart:22:1: Error:
>> out of order
>> [exec] export 'package:box2d/box2d.dart';
>> [exec] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> [exec] Error: Compilation failed.

sdk version 13679

@kasperl
Copy link

kasperl commented Oct 22, 2012

I think there's already another bug on file for the analyzer issue. If not, I'll file one.


cc @johnniwinther.
cc @peter-ahe-google.
Added this to the M2 milestone.
Removed Priority-Medium label.
Added Priority-High, Area-Dart2JS, Triaged labels.
Changed the title to: "dart2js: re-export of package imported from pub is failing ("out of order")".

@peter-ahe-google
Copy link
Contributor

I cannot reproduce this problem. You can help us a great deal if you include a complete example when you report errors.

I suspect that you have a "part" (or "#source") directive before line 22. If I modify http://code.google.com/p/dartbox2d/source/browse/example/demos/BallCage.dart to have this sequence of directives:

library BallCage;

import 'dart:html';
import 'package:box2d/box2d_browser.dart';

export 'package:box2d/box2d.dart';

part 'demo.dart';

It seems to work fine. However, if I change the order of part and export like this:

library BallCage;

import 'dart:html';
import 'package:box2d/box2d_browser.dart';

part 'demo.dart';

export 'package:box2d/box2d.dart';

I get this error:

BallCage.dart:22:1: Error: out of order
export 'package:box2d/box2d.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is to be expected as the specification requires that parts come after imports and exports:

libraryDefinition:
     libraryName importOrExport* partDirective* topLevelDefinition*
     ;


Set owner to @peter-ahe-google.
Added CannotReproduce label.

@kasperl
Copy link

kasperl commented Oct 22, 2012

Filed issue #6125 for the analyzer.

@DartBot
Copy link
Author

DartBot commented Oct 22, 2012

This comment was originally written by domi...@google.com


Looks like that's exactly what it was, but the error message I was getting was not suggestive of the problem.

@peter-ahe-google
Copy link
Contributor

Changed this bug to be about renaming the error message.


Removed Priority-High label.
Added Priority-Medium, Triaged labels.
Changed the title to: "Improve error message for out-of-order library tags".

@peter-ahe-google
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the M3 milestone.

@peter-ahe-google
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@kasperl
Copy link

kasperl commented Apr 22, 2013

Removed this from the M4 milestone.
Added this to the M5 milestone.

@kasperl
Copy link

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link

kasperl commented May 28, 2013

Removed this from the M5 milestone.
Added this to the Later milestone.
Removed TriageForM5 label.

@peter-ahe-google
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement label.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@sigmundch
Copy link
Member

This was probably fixed a while ago. The current error message looks like this:

Error: Export declarations should come before parts.
Try moving this export further up in the file.
export 'package:box2d/box2d.dart';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Added Fixed label.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants