The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add tests for unused labels

+72
+72
testsuite/tests/typing-warnings/unused_types.ml
··· 345 345 Warning 34 [unused-type-declaration]: unused type t. 346 346 module Unused_constructor_disable_warning : sig end 347 347 |}] 348 + 349 + 350 + module Unused_record : sig end = struct 351 + type t = { a : int; b : int } 352 + let foo (x : t) = x 353 + let _ = foo 354 + end;; 355 + [%%expect {| 356 + module Unused_record : sig end 357 + |}] 358 + 359 + module Unused_field : sig end = struct 360 + type t = { a : int } 361 + let foo () = { a = 0 } 362 + let _ = foo 363 + end;; 364 + [%%expect {| 365 + module Unused_field : sig end 366 + |}] 367 + 368 + module Unused_field : sig end = struct 369 + type t = { a : int; b : int; c : int } 370 + let foo () = { a = 0; b = 0; c = 0 } 371 + let bar x = x.a 372 + let baz { c; _ } = c 373 + let _ = foo, bar, baz 374 + end;; 375 + [%%expect {| 376 + module Unused_field : sig end 377 + |}] 378 + 379 + module Unused_mutable_field : sig end = struct 380 + type t = { a : int; mutable b : int } 381 + let foo () = { a = 0; b = 0 } 382 + let bar x = x.a, x.b 383 + let _ = foo, bar 384 + end;; 385 + [%%expect {| 386 + module Unused_mutable_field : sig end 387 + |}] 388 + 389 + module Unused_field_exported_private : sig 390 + type t = private { a : int } 391 + end = struct 392 + type t = { a : int } 393 + end;; 394 + [%%expect {| 395 + module Unused_field_exported_private : sig type t = private { a : int; } end 396 + |}] 397 + 398 + module Unused_field_exported_private : sig 399 + type t = private { a : int } 400 + end = struct 401 + type t = { a : int } 402 + let foo x = x.a 403 + let _ = foo 404 + end;; 405 + [%%expect {| 406 + module Unused_field_exported_private : sig type t = private { a : int; } end 407 + |}] 408 + 409 + module Unused_mutable_field_exported_private : sig 410 + type t = private { a : int; mutable b : int } 411 + end = struct 412 + type t = { a : int; mutable b : int } 413 + let foo () = { a = 0; b = 0 } 414 + let _ = foo 415 + end;; 416 + [%%expect {| 417 + module Unused_mutable_field_exported_private : 418 + sig type t = private { a : int; mutable b : int; } end 419 + |}]