173 builder.recordError(
174 CompilerDiagnostic.create({
175▶ category: ErrorCategory.Todo,
176 reason: `Handle ${param.node.type} parameters`,
177 description: `[BuildHIR] Add support for ${param.node.type} parameters`,
· · ·
250 params,
251 fnType: bindings == null ? env.fnType : 'Other',
252▶ returnTypeAnnotation: null, // TODO: extract the actual return type node if present
253 returns: createTemporaryPlace(env, func.node.loc ?? GeneratedSource),
254 body: hirBody,
· · ·
285 reason:
286 '(BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch',
287▶ category: ErrorCategory.Todo,
288 loc: stmt.node.loc ?? null,
289 suggestions: null,
· · ·
473 builder.recordError(
474 new CompilerErrorDetail({
475▶ category: ErrorCategory.Todo,
476 reason: 'Unsupported declaration type for hoisting',
477 description: `variable "${binding.identifier.name}" declared with ${binding.path.type}`,
· · ·
484 builder.recordError(
485 new CompilerErrorDetail({
486▶ category: ErrorCategory.Todo,
487 reason: 'Handle non-const declarations for hoisting',
488 description: `variable "${binding.identifier.name}" declared with ${binding.kind}`,
+ 55 more matches in this file
80 consumed: boolean;
81};
82▶// TODO: create a kind: "Alias"
83
84// type T<X> = { foo: X}
· · ·
132 *
133 *
134▶ * // (todo: disallowed)
135 *type X' = {
136 *value: number,
· · ·
247 }
248 case 'Enum': {
249▶ return 'TODO enum printing';
250 }
251 case 'Union': {
· · ·
323 );
324 }
325▶ return Resolved.todo(platform);
326 }
327 case 'Open':
· · ·
328 return Resolved.mixed(platform);
329 case 'Any':
330▶ return Resolved.todo(platform);
331 case 'Annot':
332 return convertFlowTypeImpl(
+ 5 more matches in this file
108
109 for (const ref of fn.context) {
110▶ // TODO: using InstructionValue as a bit of a hack, but it's pragmatic
111 const value: InstructionValue = {
112 kind: 'ObjectExpression',
· · ·
529 * throw (effectively) the result of the call.
530 *
531▶ * TODO: call applyEffect() instead. This meant that the catch param wasn't inferred
532 * as a mutable value, though. See `try-catch-try-value-modified-in-catch-escaping.js`
533 * fixture as an example
· · ·
581 * a known-frozen value.
582 *
583▶ * TODO: make sure we're also validating against global mutations somewhere, but
584 * account for this being allowed in effects/event handlers.
585 */
· · ·
816 effect.function.loweredFunc.func.aliasingEffects?.some(
817 effect =>
818▶ // TODO; include "render" here?
819 effect.kind === 'MutateFrozen' ||
820 effect.kind === 'MutateGlobal' ||
· · ·
1604 /*
1605 * Returns a copy of this state.
1606▶ * TODO: consider using persistent data structures to make
1607 * clone cheaper.
1608 */
+ 6 more matches in this file
337 }
338
339▶ static throwTodo(
340 options: Omit<CompilerErrorDetailOptions, 'category'>,
341 ): never {
· · ·
344 new CompilerErrorDetail({
345 ...options,
346▶ category: ErrorCategory.Todo,
347 }),
348 );
· · ·
600 break;
601 }
602▶ case ErrorCategory.Todo: {
603 heading = 'Todo';
604 break;
· · ·
603▶ heading = 'Todo';
604 break;
605 }
· · ·
689 Invariant = 'Invariant',
690 /**
691▶ * Todos
692 */
693 Todo = 'Todo',
+ 5 more matches in this file
783 new CompilerErrorDetail({
784 reason: 'Support non-trivial for..in inits',
785▶ category: ErrorCategory.Todo,
786 loc: terminal.init.loc,
787 suggestions: null,
· · ·
806 new CompilerErrorDetail({
807 reason: 'Support non-trivial for..in inits',
808▶ category: ErrorCategory.Todo,
809 loc: terminal.init.loc,
810 suggestions: null,
· · ·
884 new CompilerErrorDetail({
885 reason: 'Support non-trivial for..of inits',
886▶ category: ErrorCategory.Todo,
887 loc: terminal.init.loc,
888 suggestions: null,
· · ·
906 new CompilerErrorDetail({
907 reason: 'Support non-trivial for..of inits',
908▶ category: ErrorCategory.Todo,
909 loc: terminal.init.loc,
910 suggestions: null,
· · ·
1787 const node = instrValue.node;
1788 if (!t.isExpression(node)) {
1789▶ return node as any; // TODO handle statements, jsx fragments
1790 }
1791 value = node;
+ 4 more matches in this file
704 const isDirectlyInsideEffect = fnScope?.block === node;
705 if (isDirectlyInsideEffect) {
706▶ // TODO: we could potentially ignore early returns.
707 setStateInsideEffectWithoutDeps = key;
708 }
· · ·
961 : ['useCallback(', ')'];
962 return [
963▶ // TODO: also add an import?
964 fixer.insertTextBefore(construction.node.init!, before),
965 // TODO: ideally we'd gather deps here but it would require
· · ·
965▶ // TODO: ideally we'd gather deps here but it would require
966 // restructuring the rule code. This will cause a new lint
967 // error to appear immediately for useCallback. Note we're
· · ·
973 ];
974 }
975▶ // TODO: What if the function needs to change on every render anyway?
976 // Should we suggest removing effect deps as an appropriate fix too?
977 reportProblem({
· · ·
978▶ // TODO: Why not report this at the dependency site?
979 node: construction.node,
980 message,
+ 2 more matches in this file
19 const substMap = new Map<TypeParameterId, ResolvedType>();
20 for (let i = 0; i < typeParameters.length; i++) {
21▶ // TODO: Length checks to make sure type params match up with args
22 const typeParameter = typeParameters[i];
23 const typeArgument = typeArguments[i];
· · ·
25 }
26 const substitutionFunction = (t: ResolvedType): ResolvedType => {
27▶ // TODO: We really want a stateful mapper or visitor here so that we can model nested polymorphic types
28 if (t.type.kind === 'Generic' && substMap.has(t.type.id)) {
29 const substitutedType = substMap.get(t.type.id)!;
· · ·
52 }
53
54▶ return {kind: 'Concrete', type: substituted, platform: /* TODO */ 'shared'};
55}
56
263 const returnType = makeType();
264 /*
265▶ * TODO: callee could be a hook or a function, so this type equation isn't correct.
266 * We should change Hook to a subtype of Function or change unifier logic.
267 * (see https://github.com/facebook/react-forget/pull/1427)
· · ·
287 const returnType = makeType();
288 /*
289▶ * TODO: callee could be a hook or a function, so this type equation isn't correct.
290 * We should change Hook to a subtype of Function or change unifier logic.
291 * (see https://github.com/facebook/react-forget/pull/1427)
· · ·
485 * So we use a dummy type here.
486 *
487▶ * TODO: consider using the rvalue type here
488 */
489 makeType(),
75 * ## Other Issues Uncovered
76 *
77▶ * Mutable lifetimes need to account for aliasing (known todo, already described in InferMutableLifetimes.ts)
78 *
79 * ```javascript
· · ·
381 /*
382 * exclude global variables from being added to scopes, we can't recreate them!
383▶ * TODO: improve handling of module-scoped variables and globals
384 */
385 operand.identifier.mutableRange.start > 0
· · ·
399 /*
400 * exclude global variables from being added to scopes, we can't recreate them!
401▶ * TODO: improve handling of module-scoped variables and globals
402 */
403 operand.identifier.mutableRange.start > 0
29import path from 'path';
30import prettier from 'prettier';
31▶import SproutTodoFilter from './SproutTodoFilter';
32import {isExpectError} from './fixture-utils';
33import {makeSharedRuntimeTypeProvider} from './sprout/shared-runtime-type-provider';
· · ·
58 logs: Array<{filename: string | null; event: LoggerEvent}>;
59} {
60▶ // TODO(@mofeiZ) rewrite snap fixtures to @validatePreserveExistingMemo:false
61 let validatePreserveExistingMemoizationGuarantees = false;
62 let target: CompilerReactTarget = '19';
· · ·
67 * compiler was able to preserve existing memo.
68 *
69▶ * TODO: flip the default. `useMemo` is rare in test fixtures -- fixtures that
70 * use useMemo should be explicit about whether this flag is enabled
71 */
· · ·
284 if (
285 includeEvaluator &&
286▶ !SproutTodoFilter.has(fixturePath) &&
287 !isExpectError(filename)
288 ) {
185// output (source of truth). Skipped when running the TS compiler.
186const TS_SKIP_FIXTURES: Set<string> = new Set([
187▶ // Rust compiles successfully, TS would error. Renamed from error.todo-/error.bug-.
188 'todo-hoist-type-alias-before-declaration',
189 // Error message/format divergences
· · ·
188▶ 'todo-hoist-type-alias-before-declaration',
189 // Error message/format divergences
190 'fbt/error.todo-locally-require-fbt',
· · ·
190▶ 'fbt/error.todo-locally-require-fbt',
191 // Minor output difference (TS adds unused runtime import)
192 'use-no-forget-multiple-with-eslint-suppression',
149 } else if (effect.kind === 'Assign') {
150 /**
151▶ * TODO: Invariant that the node is not initialized yet
152 *
153 * InferFunctionExpressionAliasingEffectSignatures currently infers
· · ·
312 for (const block of fn.body.blocks.values()) {
313 for (const phi of block.phis) {
314▶ // TODO: we don't actually set these effects today!
315 phi.place.effect = Effect.Store;
316 const isPhiMutatedAfterCreation: boolean =
· · ·
327 ) {
328 /*
329▶ * TODO: ideally we'd construct a precise start range, but what really
330 * matters is that the phi's range appears mutable (end > start + 1)
331 * so we just set the start to the previous instruction before this block
263 'performance',
264 addObject(DEFAULT_SHAPES, 'performance', [
265▶ // Static methods (TODO)
266 [
267 'now',
· · ·
270 positionalParams: [],
271 restParam: Effect.Read,
272▶ returnType: {kind: 'Poly'}, // TODO: could be Primitive, but that would change existing compilation
273 calleeEffect: Effect.Read,
274 returnValueKind: ValueKind.Mutable, // same here
· · ·
282 'Date',
283 addObject(DEFAULT_SHAPES, 'Date', [
284▶ // Static methods (TODO)
285 [
286 'now',
· · ·
289 positionalParams: [],
290 restParam: Effect.Read,
291▶ returnType: {kind: 'Poly'}, // TODO: could be Primitive, but that would change existing compilation
292 calleeEffect: Effect.Read,
293 returnValueKind: ValueKind.Mutable, // same here
· · ·
301 'Math',
302 addObject(DEFAULT_SHAPES, 'Math', [
303▶ // Static properties (TODO)
304 ['PI', {kind: 'Primitive'}],
305 // Static methods (TODO)
+ 4 more matches in this file
3import fs from 'fs/promises';
4
5▶export interface Todo {
6 id: number;
7 title: string;
· · ·
11}
12
13▶export async function getTodos(): Promise<Todo[]> {
14 try {
15 let contents = await fs.readFile('todos.json', 'utf8');
· · ·
15▶ let contents = await fs.readFile('todos.json', 'utf8');
16 return JSON.parse(contents);
17 } catch {
· · ·
18▶ await fs.writeFile('todos.json', '[]');
19 return [];
20 }
· · ·
21}
22
23▶export async function getTodo(id: number): Promise<Todo | undefined> {
24 let todos = await getTodos();
25 return todos.find(todo => todo.id === id);
+ 26 more matches in this file
39 *
40 * This means references before the assignment are invalid (see fixture
41▶ * error.todo-functiondecl-hoisting)
42 */
43export function pruneHoistedContexts(fn: ReactiveFunction): void {
· · ·
90 maybeHoistedFn.definition !== place
91 ) {
92▶ CompilerError.throwTodo({
93 reason: '[PruneHoistedContexts] Rewrite hoisted function references',
94 loc: place.loc,
· · ·
156 }
157 } else {
158▶ CompilerError.throwTodo({
159 reason: '[PruneHoistedContexts] Unexpected kind',
160 description: `(${instruction.value.lvalue.kind})`,
72 * not supported by React Compiler yet.
73 */
74▶ CompilerError.throwTodo({
75 reason: `Unsupported syntax on the left side of an AssignmentExpression`,
76 description: `Expected an LVal, got: ${left.type}`,
· · ·
213 }
214 default: {
215▶ CompilerError.throwTodo({
216 reason: `[FindContextIdentifiers] Cannot handle Object destructuring assignment target ${lvalNode.type}`,
217 description: null,
198 * instruction. Only extend ranges for scopes that are actually active.
199 *
200▶ * TODO: consider pruning activeScopes per instruction
201 */
202 if (scope.range.end <= terminal.id) {
· · ·
218 * back to the outer block scope.
219 *
220▶ * TODO: add a variant of eachTerminalSuccessor() that visits _all_ successors, not
221 * just those that are direct successors for normal control-flow ordering.
222 */
74 fn.env.recordError(
75 CompilerDiagnostic.create({
76▶ category: ErrorCategory.Todo,
77 reason:
78 'ValidateContextVariableLValues: unhandled instruction variant',
· · ·
110 env.recordError(
111 CompilerDiagnostic.create({
112▶ category: ErrorCategory.Todo,
113 reason: `Support destructuring of context variables`,
114 description: null,
62 case ErrorSeverity.Invariant:
63 case ErrorSeverity.CannotPreserveMemoization:
64▶ case ErrorSeverity.Todo:
65 return false;
66 default:
· · ·
116 * single file (e.g. to report multiple rules of react violations in the
117 * same pass).
118▶ * TODO: enable non-destructive `CompilerDiagnostic` logging in dev mode,
119 * and log a "CompilationStart" event for every function we begin processing.
120 */
39 if (restrictedImports.has(importDeclPath.node.source.value)) {
40 error.push({
41▶ category: ErrorCategory.Todo,
42 reason: 'Bailing out due to blocklisted import',
43 description: `Import from module ${importDeclPath.node.source.value}`,
· · ·
204 const error = new CompilerError();
205 error.push({
206▶ category: ErrorCategory.Todo,
207 reason: 'Encountered conflicting global in generated program',
208 description: `Conflict from local binding ${name}`,
242 env.recordError(
243 CompilerDiagnostic.create({
244▶ category: ErrorCategory.Todo,
245 reason: 'Important source location missing in generated code',
246 description:
· · ·
262 env.recordError(
263 CompilerDiagnostic.create({
264▶ category: ErrorCategory.Todo,
265 reason:
266 'Important source location has wrong node type in generated code',
989 /*
990 * Visits the test block of a value terminal (optional, logical, ternary) and
991▶ * returns the result along with the branch terminal. Throws a todo error if
992 * the test block does not end in a branch terminal.
993 */
· · ·
1165 }
1166 case 'label': {
1167▶ CompilerError.throwTodo({
1168 reason: `Support labeled statements combined with value blocks (conditional, logical, optional chaining, etc)`,
1169 description: null,
· · ·
1173 }
1174 default: {
1175▶ CompilerError.throwTodo({
1176 reason: `Support \`${terminal.kind}\` as a value block terminal (conditional, logical, optional chaining, etc)`,
1177 description: null,
319 this.recordError(
320 new CompilerErrorDetail({
321▶ category: ErrorCategory.Todo,
322 reason: 'Support local variables named `fbt`',
323 description:
· · ·
390 description: null,
391 suggestions: null,
392▶ category: ErrorCategory.Todo,
393 }),
394 );
21
22// Page components. These must have "use server-entry" so they are treated as code splitting entry points.
23▶import {Todos} from './Todos';
24
25const app = express();
· · ·
35
36app.get('/', async (req, res) => {
37▶ await render(req, res, <Todos />);
38});
39
· · ·
40app.post('/', async (req, res) => {
41▶ await handleAction(req, res, <Todos />);
42});
43
· · ·
44▶app.get('/todos/:id', async (req, res) => {
45 await render(req, res, <Todos id={Number(req.params.id)} />);
46});
· · ·
45▶ await render(req, res, <Todos id={Number(req.params.id)} />);
46});
47
+ 4 more matches in this file