Skip to content

Commit

Permalink
Upgrade to flow 0.57.3
Browse files Browse the repository at this point in the history
Disable type checking in two places where flow became smart enough to detect unsoundness that it didn't before. Figuring out how to properly type these cases would be a better fix, but they are both difficult (bucket deserialization and JSON conversions).

Disable type checking in one place where flow regressed. Upstream issue is facebook/flow#5208.
  • Loading branch information
jfirebaugh committed Oct 30, 2017
1 parent e505df9 commit 0bca909
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
unsafe.enable_getters_and_setters=true

[version]
0.54.1
0.57.3
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-react": "^7.3.0",
"execcommand-copy": "^1.1.0",
"flow-bin": "^0.54.1",
"flow-bin": "^0.57.3",
"flow-coverage-report": "^0.3.0",
"flow-remove-types": "^1.0.4",
"github-slugger": "^1.1.1",
Expand Down
16 changes: 2 additions & 14 deletions src/data/bucket/symbol_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OpacityState = require('../../symbol/opacity_state');
const {getSizeData} = require('../../symbol/symbol_size');

import type {Feature as ExpressionFeature} from '../../style-spec/expression';
import type {Bucket, BucketParameters, IndexedFeature, PopulateParameters} from '../bucket';
import type {Bucket, IndexedFeature, PopulateParameters} from '../bucket';
import type {ProgramInterface, SerializedProgramConfiguration} from '../program_configuration';
import type CollisionBoxArray, {CollisionBox} from '../../symbol/collision_box';
import type {
Expand All @@ -29,18 +29,6 @@ import type {
import type SymbolStyleLayer from '../../style/style_layer/symbol_style_layer';
import type {SymbolQuad} from '../../symbol/quads';

type SymbolBucketParameters = BucketParameters & {
sdfIcons: boolean,
iconsNeedLinear: boolean,
fontstack: string,
textSizeData: any,
iconSizeData: any,
placedGlyphArray: StructArray,
placedIconArray: StructArray,
glyphOffsetArray: StructArray,
lineVertexArray: StructArray,
}

export type SingleCollisionBox = {
x1: number;
y1: number;
Expand Down Expand Up @@ -399,7 +387,7 @@ class SymbolBucket implements Bucket {
uploaded: boolean;
collisionCircle: SymbolBuffers;

constructor(options: SymbolBucketParameters) {
constructor(options: any) {
this.collisionBoxArray = options.collisionBoxArray;
this.zoom = options.zoom;
this.overscaling = options.overscaling;
Expand Down
6 changes: 2 additions & 4 deletions src/source/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ export interface Source {
reparseOverscaled?: boolean,
vectorLayerIds?: Array<string>,

constructor(id: string, source: SourceSpecification, dispatcher: Dispatcher, eventedParent: Evented): Source;

fire(type: string, data: Object): mixed;

+onAdd?: (map: Map) => void;
Expand All @@ -75,7 +73,7 @@ export interface Source {
+prepare?: () => void;
}

const sourceTypes: {[string]: Class<Source>} = {
const sourceTypes = {
'vector': require('../source/vector_tile_source'),
'raster': require('../source/raster_tile_source'),
'geojson': require('../source/geojson_source'),
Expand All @@ -95,7 +93,7 @@ const sourceTypes: {[string]: Class<Source>} = {
* @returns {Source}
*/
exports.create = function(id: string, specification: SourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {
const source = new sourceTypes[specification.type](id, specification, dispatcher, eventedParent);
const source = new sourceTypes[specification.type](id, (specification: any), dispatcher, eventedParent);

if (source.id !== id) {
throw new Error(`Expected Source id to be ${id} instead of ${source.id}`);
Expand Down
2 changes: 1 addition & 1 deletion src/source/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class Worker {
}
};

this.workerSources[mapId][type] = new this.workerSourceTypes[type]((actor: any), this.getLayerIndex(mapId));
this.workerSources[mapId][type] = new (this.workerSourceTypes[type]: any)((actor: any), this.getLayerIndex(mapId));
}

return this.workerSources[mapId][type];
Expand Down
5 changes: 2 additions & 3 deletions src/source/worker_source.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// @flow

import type TileCoord from './tile_coord';
import type Actor from '../util/actor';
import type StyleLayerIndex from '../style/style_layer_index';
import type {SerializedBucket} from '../data/bucket';
import type {SerializedFeatureIndex} from '../data/feature_index';
import type {SerializedStructArray} from '../util/struct_array';
Expand Down Expand Up @@ -51,7 +49,8 @@ export type WorkerTileCallback = (error: ?Error, result: ?WorkerTileResult, tran
* @param layerIndex
*/
export interface WorkerSource {
constructor(actor: Actor, layerIndex: StyleLayerIndex): WorkerSource;
// Disabled due to https://github.com/facebook/flow/issues/5208
// constructor(actor: Actor, layerIndex: StyleLayerIndex): WorkerSource;

/**
* Loads a tile from the given params and parse it into buckets ready to send
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4072,9 +4072,9 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"

flow-bin@^0.54.1:
version "0.54.1"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.54.1.tgz#7101bcccf006dc0652714a8aef0c72078a760510"
flow-bin@^0.57.3:
version "0.57.3"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.57.3.tgz#843fb80a821b6d0c5847f7bb3f42365ffe53b27b"

flow-coverage-report@^0.3.0:
version "0.3.0"
Expand Down

0 comments on commit 0bca909

Please sign in to comment.