@effect/language-service 0.22.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -832,29 +832,11 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
832
832
  });
833
833
 
834
834
  // src/core/Nano.ts
835
- var NanoInternalSuccessProto = {
836
- _tag: "Right"
837
- };
838
835
  function makeInternalSuccess(value) {
839
- const result = Object.create(NanoInternalSuccessProto);
840
- result.value = value;
841
- return result;
836
+ return { _tag: "Right", value };
842
837
  }
843
- var NanoInternalFailureProto = {
844
- _tag: "Left"
845
- };
846
- function makeInternalFailure(value) {
847
- const result = Object.create(NanoInternalFailureProto);
848
- result.value = value;
849
- return result;
850
- }
851
- var NanoInternalDefectProto = {
852
- _tag: "Defect"
853
- };
854
838
  function makeInternalDefect(value) {
855
- const result = Object.create(NanoInternalDefectProto);
856
- result.value = value;
857
- return result;
839
+ return { _tag: "Defect", value };
858
840
  }
859
841
  var NanoDefectException = class {
860
842
  constructor(message) {
@@ -869,17 +851,14 @@ var NanoTag = class {
869
851
  };
870
852
  var Tag = (identifier) => new NanoTag(identifier);
871
853
  var contextEmpty = { value: {} };
872
- var Proto = {
873
- run: () => {
874
- },
875
- [Symbol.iterator]() {
876
- return new SingleShotGen(new YieldWrap(this));
877
- }
878
- };
879
854
  function make3(run2) {
880
- const result = Object.create(Proto);
881
- result.run = run2;
882
- return result;
855
+ const nano = {
856
+ run: run2,
857
+ [Symbol.iterator]() {
858
+ return new SingleShotGen(new YieldWrap(this));
859
+ }
860
+ };
861
+ return nano;
883
862
  }
884
863
  var unsafeRun = (fa) => {
885
864
  const program = provideService(internalNanoCache, {})(fa);
@@ -900,9 +879,33 @@ var run = (fa) => {
900
879
  return left2(new NanoDefectException(e));
901
880
  }
902
881
  };
903
- var succeed = (value) => make3(() => makeInternalSuccess(value));
904
- var fail = (value) => make3(() => makeInternalFailure(value));
905
- var sync = (value) => make3(() => makeInternalSuccess(value()));
882
+ var succeed = (value) => {
883
+ const nano = {
884
+ run: () => ({ _tag: "Right", value }),
885
+ [Symbol.iterator]() {
886
+ return new SingleShotGen(new YieldWrap(this));
887
+ }
888
+ };
889
+ return nano;
890
+ };
891
+ var fail = (value) => {
892
+ const nano = {
893
+ run: () => ({ _tag: "Left", value }),
894
+ [Symbol.iterator]() {
895
+ return new SingleShotGen(new YieldWrap(this));
896
+ }
897
+ };
898
+ return nano;
899
+ };
900
+ var sync = (value) => {
901
+ const nano = {
902
+ run: () => ({ _tag: "Right", value: value() }),
903
+ [Symbol.iterator]() {
904
+ return new SingleShotGen(new YieldWrap(this));
905
+ }
906
+ };
907
+ return nano;
908
+ };
906
909
  var flatMap2 = dual(2, (fa, f) => make3((ctx) => {
907
910
  const result = fa.run(ctx);
908
911
  if (result._tag !== "Right") return result;
@@ -995,8 +998,9 @@ function cachedBy(fa, key, lookupKey) {
995
998
  cacheObj[key] = cache;
996
999
  }
997
1000
  const lookup = lookupKey(...args);
998
- if (cache.has(lookup)) {
999
- return cache.get(lookup);
1001
+ const cached2 = cache.get(lookup);
1002
+ if (cached2 !== void 0) {
1003
+ return cached2;
1000
1004
  }
1001
1005
  const result = fa(...args).run(ctx);
1002
1006
  cache.set(lookup, result);
@@ -3259,22 +3263,24 @@ var missingEffectContext = createDiagnostic({
3259
3263
  const sortTypes = sort(typeOrder);
3260
3264
  const entries = yield* expectedAndRealType(sourceFile);
3261
3265
  for (const [node, expectedType, valueNode, realType] of entries) {
3262
- const missingContext = yield* pipe(
3263
- checkForMissingContextTypes(
3264
- node,
3265
- expectedType,
3266
- valueNode,
3267
- realType
3268
- ),
3269
- orElse2(() => succeed([]))
3270
- );
3271
- if (missingContext.length > 0) {
3272
- report(
3273
- {
3266
+ if (expectedType !== realType) {
3267
+ yield* pipe(
3268
+ checkForMissingContextTypes(
3274
3269
  node,
3275
- messageText: `Missing '${sortTypes(missingContext).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect context.`,
3276
- fixes: []
3277
- }
3270
+ expectedType,
3271
+ valueNode,
3272
+ realType
3273
+ ),
3274
+ map4(
3275
+ (missingTypes) => missingTypes.length > 0 ? report(
3276
+ {
3277
+ node,
3278
+ messageText: `Missing '${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect context.`,
3279
+ fixes: []
3280
+ }
3281
+ ) : void 0
3282
+ ),
3283
+ ignore
3278
3284
  );
3279
3285
  }
3280
3286
  }
@@ -3305,22 +3311,24 @@ var missingEffectError = createDiagnostic({
3305
3311
  const sortTypes = sort(typeOrder);
3306
3312
  const entries = yield* expectedAndRealType(sourceFile);
3307
3313
  for (const [node, expectedType, valueNode, realType] of entries) {
3308
- const missingContext = yield* pipe(
3309
- checkForMissingErrorTypes(
3310
- node,
3311
- expectedType,
3312
- valueNode,
3313
- realType
3314
- ),
3315
- orElse2(() => succeed([]))
3316
- );
3317
- if (missingContext.length > 0) {
3318
- report(
3319
- {
3314
+ if (expectedType !== realType) {
3315
+ yield* pipe(
3316
+ checkForMissingErrorTypes(
3320
3317
  node,
3321
- messageText: `Missing '${sortTypes(missingContext).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect errors.`,
3322
- fixes: []
3323
- }
3318
+ expectedType,
3319
+ valueNode,
3320
+ realType
3321
+ ),
3322
+ map4(
3323
+ (missingTypes) => missingTypes.length > 0 ? report(
3324
+ {
3325
+ node,
3326
+ messageText: `Missing '${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect errors.`,
3327
+ fixes: []
3328
+ }
3329
+ ) : void 0
3330
+ ),
3331
+ ignore
3324
3332
  );
3325
3333
  }
3326
3334
  }