diff --git a/src/Zilf/ZModel/Vocab/OldParser/OldParserWord.cs b/src/Zilf/ZModel/Vocab/OldParser/OldParserWord.cs index 2bc86718e38de94f4af1f0277e2e3b1f99313210..deb5321c170b079c5635fc91b09d0e3dca42d411 100644 --- a/src/Zilf/ZModel/Vocab/OldParser/OldParserWord.cs +++ b/src/Zilf/ZModel/Vocab/OldParser/OldParserWord.cs @@ -492,22 +492,40 @@ namespace Zilf.ZModel.Vocab.OldParser public void Merge(Context ctx, OldParserWord other) { if ((other.PartOfSpeech & PartOfSpeech.Adjective) != 0) + { + UnsetPartOfSpeech(ctx, PartOfSpeech.Adjective); SetAdjective(ctx, other.GetDefinition(PartOfSpeech.Adjective), other.GetValue(PartOfSpeech.Adjective)); + } if ((other.PartOfSpeech & PartOfSpeech.Buzzword) != 0) + { + UnsetPartOfSpeech(ctx, PartOfSpeech.Buzzword); SetBuzzword(ctx, other.GetDefinition(PartOfSpeech.Buzzword), other.GetValue(PartOfSpeech.Buzzword)); + } if ((other.PartOfSpeech & PartOfSpeech.Direction) != 0) + { + UnsetPartOfSpeech(ctx, PartOfSpeech.Direction); SetDirection(ctx, other.GetDefinition(PartOfSpeech.Direction), other.GetValue(PartOfSpeech.Direction)); + } if ((other.PartOfSpeech & PartOfSpeech.Object) != 0) + { + UnsetPartOfSpeech(ctx, PartOfSpeech.Object); SetObject(other.GetDefinition(PartOfSpeech.Object)); + } if ((other.PartOfSpeech & PartOfSpeech.Preposition) != 0) + { + UnsetPartOfSpeech(ctx, PartOfSpeech.Preposition); SetPreposition(ctx, other.GetDefinition(PartOfSpeech.Preposition), other.GetValue(PartOfSpeech.Preposition)); + } if ((other.PartOfSpeech & PartOfSpeech.Verb) != 0) + { + UnsetPartOfSpeech(ctx, PartOfSpeech.Verb); SetVerb(ctx, other.GetDefinition(PartOfSpeech.Verb), other.GetValue(PartOfSpeech.Verb)); + } MarkAsSynonym(other.PartOfSpeech & ~PartOfSpeech.FirstMask); } diff --git a/test/Zilf.Tests.Integration/VocabTests.cs b/test/Zilf.Tests.Integration/VocabTests.cs index 2dc3a47a522f91d45502bd01fa2281f513be98ed..bf572d2384786096a8b3feb2b0811a3e18f5f4a5 100644 --- a/test/Zilf.Tests.Integration/VocabTests.cs +++ b/test/Zilf.Tests.Integration/VocabTests.cs @@ -359,6 +359,30 @@ namespace Zilf.Tests.Integration "<=? 0>"); } + [TestMethod] + public async Task Synonym_Used_As_Preposition_Should_Copy_The_Preposition_Number() + { + await AssertGlobals( + "", + "", + "", + ">") + .InV3() + .ImpliesAsync( + // original word ON should be a preposition = PR?ON + "<=? ,PS?PREPOSITION>", + "<=? ,PR?ON>", + "<=? 0>", + // synonym ONTO should also be a preposition = PR?ON + "<=? ,PS?PREPOSITION>", + "<=? ,PR?ON>", + "<=? 0>", + // preposition table should only list ON + "<=? 1>", + "<=? ,W?ON>", + "<=? ,PR?ON>"); + } + #endregion } }