Skip to content

Conversation

@fredj
Copy link
Member

@fredj fredj commented Jun 24, 2015

The compiler should be able to detect that:

var collection = new ol.Collection(null);

or:

collection.extend(null);

are invalid

@fredj fredj force-pushed the collection_null_array branch from 8af4e0b to 83f43fc Compare June 24, 2015 15:27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reasons for removing the types here? Note that these were not typecasts.

@elemoine
Copy link
Member

LGTM. Just wondering about the removal of types in the select interaction.

@fredj
Copy link
Member Author

fredj commented Jun 25, 2015

Without these types removal, the compiler considers that {Array.<ol.Feature>} may be null and returns an error:

ERR! compile found   : (Array<(null|ol.Feature)>|null)
ERR! compile required: Array<(null|ol.Feature)>
ERR! compile     features.extend(selected);
ERR! compile                     ^
ERR! compile 

@fredj
Copy link
Member Author

fredj commented Jun 25, 2015

Instead of removing the type, I'll change it to {!Array.<ol.Feature>}

@elemoine
Copy link
Member

Instead of removing the type, I'll change it to {!Array.<ol.Feature>}

Yes, I was going to suggest the same.

@fredj fredj force-pushed the collection_null_array branch from 83f43fc to 8cf5794 Compare June 25, 2015 07:11
@fredj
Copy link
Member Author

fredj commented Jun 25, 2015

Thanks for the review

fredj added a commit that referenced this pull request Jun 25, 2015
Prevent null array to be passed to an ol.Collection
@fredj fredj merged commit ced3633 into openlayers:master Jun 25, 2015
@fredj fredj deleted the collection_null_array branch June 25, 2015 07:25
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

Successfully merging this pull request may close these issues.

2 participants