dart-lang / sdk

The Dart SDK, including the VM, dart2js, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
9.93k stars 1.53k forks source link

Analyzer allows augmentations in standard library files #55249

Open DanTup opened 3 months ago

DanTup commented 3 months ago

The analyzer accepts this in a simple Dart library:

class A {}

augment class A {}

However the runtime rejects the augment keyword here.

I couldn't actually find it explicitly stated in https://github.com/dart-lang/language/blob/main/working/augmentation-libraries/feature-specification.md whether augmentations are allowed in normal libraries or only in library augmentations, but I think the intention is that they are only allowed in library augmentations, in which case the analyzer should be producing an error on augment.

pq commented 3 months ago

/fyi @scheglov