Attaching library to form isn't working I'm using hook_form_alter.  I'm having a weird situation where attaching my library works only if I do what I would think is incorrect:

$form['#attached']['library'] = array('somemodule/somelibrary');

But not if I do this:

$form['#attached']['library'][] = array('somemodule/somelibrary');

What could cause a thing like this?  I debugged to see what was happening in the FormBuilder, but it seems like the library is added either way.  It's not removed by any other module or anything.
Those two statements are not equal.

$form['#attached']['library'] = array('somelibrary');

Resets the library array to only contain "somelibrary".  This would remove anyone else's library that may need to get loaded.

$form['#attached']['library'][] = 'somelibrary';

This adds "somelibrary" to the existing libraries array for inclusion. (this is correct)

$form['#attached']['library'][] = array('somelibrary');

This is the wrong structure.

For Drupal 8

$form['#attached']['library'][] = 'somemodule/somelibrary';